View topic - QNX 4.25 - Get CPU info

Page 1 of 1

QNX 4.25 - Get CPU info

PostPosted: Thu May 31, 2007 11:46 pm
by skeepa
Hi, I need a process or application to get the CPU info, could you help me?
I need CPU type (P3,P4,586,etc) and speed.

Thanks

RE: QNX 4.25 - Get CPU info

PostPosted: Fri Jun 01, 2007 4:25 am
by maschoen
I'm out of town without documentation nearby, But I'm pretty sure that there is a qnx_...() routine that gives you this information
back in a structure. It also gives you specific process information.

RE: QNX 4.25 - Get CPU info

PostPosted: Fri Jun 01, 2007 1:26 pm
by mario
Yes it's qnx_osinfo() and in the structure returned there is a flag containing CPU type information.

RE: QNX 4.25 - Get CPU info

PostPosted: Fri Jun 01, 2007 2:13 pm
by skeepa
Thanks Mario. I tried the following example:

#include <stdio.h>
#include <sys/osinfo.h>

struct _osinfo osdata;

void main()
{
if( qnx_osinfo( 0, &osdata ) != -1 )
printf( "Cpu speed is %d\n", osdata.cpu_speed );
}

result: Cpu speed is 62942

What does this number mean?

RE: QNX 4.25 - Get CPU info

PostPosted: Fri Jun 01, 2007 3:18 pm
by maschoen
It's a relative number. It provides an approximate way to compare the speed of two processors, but historically it has not been very accurate. Judging the speed of a processor is very complex as issues like cache or instruction order can dramatically change the rate at which instructions are executed. I've never seen the algorithm published, but if you are real concerned you might check with QNX for details.