问题标签 [sysinfo]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1064 浏览

python - Python平台独立方式获取系统信息

我想知道是否有一种独立于平台的方式来获取 linux、windows、mac 的系统信息。我知道您可以使用平台模块来获取一些基本信息。我正在寻找更详细的信息,例如

  1. CPU 信息,如逻辑核心数、物理核心数、插槽数、频率、功能
  2. 物理内存总量
  3. 磁盘空间——总计,每个磁盘的可用空间
  4. 网络接口、mac 地址、ip 地址(ipv4/ipv6)、速度、主机名
  5. 操作系统信息
0 投票
1 回答
930 浏览

linux - 打印内核模块中的进程数

我对内核编程很陌生,我写了一个像这样的小内核模块,

模组

Makefile 看起来像这样,

如果我从终端发出 make,它会给出错误
致命错误:sys/sysinfo.h:没有这样的文件或目录

你能告诉我这里有什么问题吗?

0 投票
2 回答
2895 浏览

c - linux c:sysinfo获取错误的内存值

sysinfo用来获取内存信息。但结果似乎是错误的,因为它与/proc/meminfo.

我的代码:

输出信息是:

/proc/meminfo显示:

free显示:

很明显我的代码有问题,因为我在这台服务器上确实没有 135443968000 字节(几乎 126 Gb,太大了)。

核心:

0 投票
3 回答
7735 浏览

go - Golang 检索应用程序正常运行时间

我正在尝试检索我的Go应用程序的当前正常运行时间。

我已经看到有一个包syscall提供了一个type Sysinfo_t和一个方法Sysinfo(*Sysinfo_t),它显然允许您检索正常运行时间(因为它是Sysinfo_t结构的一个字段)

到目前为止我所做的是:

问题是在编译时我得到了这个:

我搜索了一下,显然该方法和类型仅在 Linux 上可用,我需要该应用程序在 Linux 和 OsX(我目前正在使用)上运行。

是否有一种交叉兼容的方式来检索应用程序的正常运行时间?

注意:我宁愿不使用任何第三方库(除非它们是绝对必要的)

0 投票
1 回答
1441 浏览

c++ - 如何以编程方式检索 OS X board-id 信息

如何在 C++ 中以编程方式检索以下信息:

这是 Mac OSX 中的终端命令:

我使用 IOKit 库来检索 IOPlatformSerialNumber 和 PlatformUUID 信息等信息。但我找不到“board-id”的任何对应键。

0 投票
0 回答
190 浏览

c - sysinfo 返回线程数而不是进程数

根据 sysinfo 的手册页结构 sysinfo 具有:

但是当我使用 sysinfo 时,procs 的值是线程数。

0 投票
1 回答
60 浏览

linux - how does linux keep system status information?

I know that there is sysinfo structure under <sys/sysinfo.h> header file which stores the information.

But i wanted to know, how does Linux keep this information?, how does it initialize the structure?, When is it created and how is it stored?, How is it updated?, Can we customize the structure?

Is there are a file in which keep this information!?. Is there a alternate way to get system status information? can we bypass this and can directly get the status from the hardware.

(Attach resource if possible)

0 投票
1 回答
93 浏览

php - 如何在 php 中提取用户笔记本电脑/台式机模型

请我正在寻找一种在 php 中获取用户系统信息的方法,主要是笔记本电脑/台式机制造商的名称,例如联想/惠普

我知道phpsysinfo,但它似乎没有这样的信息。

0 投票
1 回答
1032 浏览

windows-10 - Windows 版本(Winver 与 sysinfo)

我正在运行 Windows 10。

我使用运行命令“winver”查看版本信息,但是“MSsysinfo32.exe”对话框告诉我不同​​的版本号。(我说的不是构建号,而是 1803 版本。)

为什么存在差异和/或他们告诉我不同​​的标准?都说版本。

在此处输入图像描述

0 投票
1 回答
22 浏览

c++ - 计算 num_cpus 时,gutil 的 sysinfo.cc 是否缺少右括号?

我有古蒂尔的 sysinfo.cc 文件,与这个文件相同: https ://github.com/cloudera/kudu/blob/master/src/kudu/gutil/sysinfo.cc#L248 我想知道 InitializeSystemInfo()鉴于我对 C++ 不太熟悉,该函数适用于 Linux。

我在第 248 行找不到这个 do 语句的右括号,那么它还能正确计算 numcpus 吗?