http://embedded.kleier.selfhost.me/raspberry_cpu_temp.php
http://blog.csdn.net/finewind/article/details/48732581
Http://elinux.org/Jetson/Thermal
To observe the temperature changes with small heat capacity the timely resolution is as high as must. Therefore the measuring script must be efficient.
How does compiled the code compare with interpreted code in terms of speed?
The ARM platform may be like this:
# cat/sys/devices/virtual/thermal/thermal_zone0/temp
# cat/sys/class/thermal/thermal_zone0/temp
The x86 platform may be like this:
# cat/proc/acpi/thermal_zone/thrm/temperature
To make it easier to read CPU temperature information, we can write some small programs to improve efficiency.
One, Bash script
Cat/proc/uptime > ${outfile} for
((i=0;i<10000;++i)), do
(date "+%s.%3n"; cat/sys/devices/virtual/ther mal/thermal_zone0/temp) |\
awk ' {if (nr%2) date = $ else print date, $} '
Done >> ${outfile}
cat/proc/uptime >> ${outfile}
Second, C language
#define _POSIX_C_SOURCE 199309L//enable interface for struct Timespec ... #include <time.h& Gt struct Timespec, clock_gettime #include <stdio.h>//FILE, fscanf, stdout, printf const unsigned N
= 10000;
typedef struct {struct TIMESPEC t;
Unsigned temp.
RecT;
int main () {RecT R [N];
for (unsigned i = 0; i < N; ++i) {(void) clock_gettime (Clock_realtime, &r [i].t);
FILE *FP = fopen ("/sys/devices/virtual/thermal/thermal_zone0/temp", "R");
(void) fscanf (FP, "%u", &r [i].temp);
(void) fclose (FP);} for (unsigned i = 0; i < N; ++i) printf ("%lu.%0
6llu%u\n ", R [I].t.tv_sec, (R [i].t.tv_nsec + 500ull)/1000ull, R [i].temp); return 0;}