NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: 11 beta testing



RVP <rvp%SDF.ORG@localhost> writes:
> On 2025年10月10日, Van Ly wrote:
>
>> [acpitz0]
>> temperature: 50.000 127.000 degC
>> [coretemp0]
>> cpu0 temperature: 47.000 degC
>> [coretemp1]
>> cpu1 temperature: 45.000 degC
>> [thinkpad0]
>> temperature 0: 50.000 degC
>>
>
> The reason for the refresh failure was something else. See PR pkg/59702.
>
>> but the btop reading says 57degC.
>>
>
> Dunno why this is. For me, envstat and btop both agree on the various temp.
> readings.
>
At the moment btop reads 46degC and the following script reads 42.000, 43.000
 #!/bin/sh
 envstat | awk '
 /cpu[0-9]/ {
 	 core = substr(1,ドル 4);
 	 temp = 3ドル;
 	 print core ":" temp;
 }'
>> RVP <rvp%SDF.ORG@localhost> writes:
>> 
>> >
>> > It sort-of works for me, even though it's not fully correct (uses `coretemp0'
>> > values for _all_ CPUs).
>>
>> I fed the AI code assistant the following prompt to see if the correct
>> behavior in `envstat' can be ported to btop.
>>
>
> Oh, I know how to fix this properly--just a small matter of programming is all :)
> And then, there also needs to be a small discussion with the kernel people about
> the stability of the sensor indexes in the XML data retrieved from the kernel.
> The way most of the matching is being done by most such programs on NetBSD
> (on the description string values) is _very_ error-prone.
>
> See this thread:
>
> https://www.unitedbsd.com/d/1311-battery-data-such-as-vendor-model/21
>
The first thing I asked of the code assistant was for at tool to
flowchart the logic in envstat and btop but the friction and hoops to
jump thru lead to a timebomb. I think it should be possible to infer
what's going with the kernel and the cpu temperature reading using an
initial schematic like the citric acid cycle
 https://sdf.org/~van.ly/img/citric_acid_cycle.jpg
The AI says, as a temporary fix, use the above shell script output in
btop. It is unable to swap out the following part in btop for the shell
script.
 regex_t r;
 if (regcomp(&r, "(cpu[0-9]* )*temperature", REG_EXTENDED)) {
 	Logger::warning("regcomp() failed");
 	return;
 }
 string prop_description = "no description";
 while ((fields = (prop_dictionary_t) prop_object_iterator_next(prop_object_iterator_t(fields_iter))) != NULL) {
 	props = (prop_dictionary_t) prop_dictionary_get(fields, "device-properties");
 	if (props != NULL) continue;
 	prop_object_t cur_value = prop_dictionary_get(fields, "cur-value");
 	prop_object_t max_value = prop_dictionary_get(fields, "critical-max");
 	prop_object_t description = prop_dictionary_get(fields, "description");
 	if (description == NULL || cur_value == NULL) {
 		continue;
 	}
 	prop_description = prop_string_cstring(prop_string_t(description));
 	// if (prop_description == "temperature") {
 	if (regexec(&r, prop_description.c_str(), 0, NULL, 0) == 0) {
 		current_temp = prop_number_integer_value(prop_number_t(cur_value));
 		if (max_value != NULL) {
 			current_cpu.temp_max = MUKTOC(prop_number_integer_value(prop_number_t(max_value)));
 		}
 	}
 }
 regfree(&r);
-- 
vl


Home | Main Index | Thread Index | Old Index

AltStyle によって変換されたページ (->オリジナル) /