一年前,一台 4K 电视回家了,上周终于有了一款可以以该分辨率驱动电视的显卡。 该卡有一个巨大的散热器,但没有风扇。 没有风扇意味着不会产生太多热量(我希望如此),这意味着古老的 250W 电源所需的功率更少。 电脑运行Linux,在网上查了一下,我发现这些命令可以检查机箱内的温度传感器。 绿色的Netflix是 Linux 计算机的名称。
nvidia-settings and sensors commands to show temperaturenvidia-settings and sensors commands to show temperaturenvidia-settings and sensors commands to show temperaturenvidia-settings and sensors commands to show temperaturenvidia 设置和传感器命令显示温度
这两个命令显示 Nvidia(显卡)温度为 53C,CPU 温度为 46C 到 53C。 传感器命令似乎还表明 80C 是令人担忧的社区的开始。 目前,在写这篇文章时显卡处于空闲状态,温度很低。 显示全屏4K视频会比较吃力,温度也会升高。 多少、多快?
为了找到答案,JMP 将循环运行 Linux 命令,记录结果并制作一个随着数据收集而更新的图表。 神奇之处在于 RunProgram(一个 JSL 函数)和 plink(一个外部程序,putty 包的一部分,在 Windows 上运行)。在此之前,需要做一些事情。
首先,Linux 主机需要运行 SSH 服务器,并且需要适当保护。 我使用过类似的网站这和这这是为了解决这个问题。
接下来,您需要在 Windows 计算机上安装 plink。 我选择了msi安装程序这里然后阅读这弄清楚 plink 是如何工作的。
最后,配置 puttygen/putty/plink 以使用带有密钥的 ssh 连接(相同这从上面),这样您就不会将密码放在显眼的地方。
现在运行一个非常简单的测试,看看一切是否都就位。 普林克是您的 Windows 计算机将要运行的程序(putty 安装的一部分)。 Netflix也是我的Linux计算机在putty程序中的配置名称。传感器是 Linux 计算机将运行的程序的名称。 和文本告诉 RunProgram 在传感器完成后仅返回传感器的所有文本输出。
Output of sensors command showing B0 for degree symbolOutput of sensors command showing B0 for degree symbolOutput of sensors command showing B0 for degree symbolOutput of sensors command showing B0 for degree symbol传感器命令的输出显示 B0 表示度数符号
高亮显示的 B0 应该是度数符号。 RunProgram 假定可执行文件的输出是 7 位 ASCII,而不是 Unicode。 要解决此问题,请使用 blob 选项并将 blob 转换为文本。 此示例将运行两个命令。 保存命令的 JSL 字符串使用引号内的 \[ 和 ]\ 字符,以便以后在需要时更容易使用特殊字符。 分号分隔两个 Linux 命令。 您可以看到感兴趣的黄色高亮值,后面是度数符号(不是 B0)。
RunProgram with the blob option returns binary data which might convert to UnicodeRunProgram with the blob option returns binary data which might convert to UnicodeRunProgram with the blob option returns binary data which might convert to UnicodeRunProgram with the blob option returns binary data which might convert to Unicode带有 blob 选项的 RunProgram 返回可能转换为 Unicode 的二进制数据
反复创建与 Linux 计算机的连接是可以的,但并不理想。 创建一次就可以避免开销。 我将通过编写一个让 Linux 计算机运行的循环来实现这一点,并有短暂的延迟。 ReadFunction 仍然会得到一个 blob,但它将成为一个实际的 JSL 函数,从 Linux 计算机获取文本块。 这些块被连接在一起,解析感兴趣的值,并将值添加到数据表中。
// open a data table to record results
dt = New Table( "temperature",
New Column( "time", Format( "hr:m:s", 13, 0 ) ),
New Column( "gpu" ),
New Column( "PhysicalID0" ),
New Column( "Core0" ),
New Column( "Core1" ),
New Column( "Core2" ),
New Column( "Core3" )
);
start = Tick Seconds(); // capture initial time to subtract out later
buffer = Char To Blob( "" ); // buffer several reads together; init to empty
rp = RunProgram( // launch the long-running external program; note the shell command "while [ 1 ]" and the "sleep 2"
executable( "plink" ),
options( {"netflix", "\[while [ 1 ]; do nvidia-settings -c :0 -q gpucoretemp; sensors; sleep 2; done]\"} ), // inxi -Fxz
readfunction(
Function( {this}, {},
While( this << canread,
buffer = buffer || (this << read( "blob" ));
Wait( 0.1 ); // try to grab up all of the output for each 2-second report
);
If( Length( buffer ) > 0, // not always
text = Blob To Char( buffer ); // there is a remote possibility a unicode sequence gets split here
buffer = Char To Blob( "" ); // reset empty
dt << addrow( 1 ); // build the table
dt:time = Tick Seconds() - start; // apply offset to get 0 time for start
dt:gpu = Num( Regex( text, "\[Attribute 'GPUCoreTemp' \(Netflix.local:0.0\): (\d+)]\", "\1" ) );
dt:PhysicalID0 = Num( Regex( text, "\[Physical id 0: \+(\d+)]\", "\1" ) );
dt:Core0 = Num( Regex( text, "\[Core 0: \+(\d+)]\", "\1" ) );
dt:Core1 = Num( Regex( text, "\[Core 1: \+(\d+)]\", "\1" ) );
dt:Core2 = Num( Regex( text, "\[Core 2: \+(\d+)]\", "\1" ) );
dt:Core3 = Num( Regex( text, "\[Core 3: \+(\d+)]\", "\1" ) );
//write("\!n", gpu," ",PhysicalID0," ",Core0," ",Core1," ",Core2," ",Core3 );
);
)
)
);
Wait( 10 ); // wait for a few rows before launching
dt << Graph Builder(
Size( 679, 444 ),
Show Control Panel( 0 ),
Variables(
X( :time ),
Y( :gpu ),
Y( :PhysicalID0, Position( 1 ) ),
Y( :Core0, Position( 1 ) ),
Y( :Core1, Position( 1 ) ),
Y( :Core2, Position( 1 ) ),
Y( :Core3, Position( 1 ) )
),
Elements( Smoother( X, Y( 1 ), Y( 2 ), Y( 3 ), Y( 4 ), Y( 5 ), Y( 6 ), Legend( 4 ), Lambda( 4.32912374502826 ) ) ),
SendToReport(
Dispatch( {}, "graph title", TextEditBox, {Set Text( "Temperatures" )} ),
Dispatch( {}, "X title", TextEditBox, {Set Text( "H:M:S" )} ),
Dispatch( {}, "Y title", TextEditBox, {Set Text( "Centigrade" )} )
)
);
Wait( 10000 ); // wait 10,000 seconds, then...
rp = 0; // kill it. it is in a loop.
The 5 non-GPU temperatures track togetherThe 5 non-GPU temperatures track togetherThe 5 non-GPU temperatures track togetherThe 5 non-GPU temperatures track together5 个非 GPU 温度一起跟踪
《萤火虫》两集。 最初的 15 分钟是滚动浏览选项,寻找值得观看的内容。 视频结束后的最后几分钟是 CPU 硬循环。 我不小心在 10,000 秒之前结束了程序。