View topic - QNX 4.25 - Get CPU info

QNX 4.25 - Get CPU info

For the old QNX2 and QNX4 RTOS

QNX 4.25 - Get CPU info

Postby skeepa » Thu May 31, 2007 11:46 pm

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
Last edited by skeepa on Fri Jun 01, 2007 1:18 pm, edited 1 time in total.
skeepa
New Member
 
Posts: 2
Joined: Thu May 31, 2007 11:42 pm

RE: QNX 4.25 - Get CPU info

Postby maschoen » Fri Jun 01, 2007 4:25 am

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.
maschoen
QNX Master
 
Posts: 2715
Joined: Wed Jun 25, 2003 5:18 pm

RE: QNX 4.25 - Get CPU info

Postby mario » Fri Jun 01, 2007 1:26 pm

Yes it's qnx_osinfo() and in the structure returned there is a flag containing CPU type information.
mario
QNX Master
 
Posts: 4132
Joined: Sun Sep 01, 2002 1:04 am

RE: QNX 4.25 - Get CPU info

Postby skeepa » Fri Jun 01, 2007 2:13 pm

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?
skeepa
New Member
 
Posts: 2
Joined: Thu May 31, 2007 11:42 pm

RE: QNX 4.25 - Get CPU info

Postby maschoen » Fri Jun 01, 2007 3:18 pm

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.
maschoen
QNX Master
 
Posts: 2715
Joined: Wed Jun 25, 2003 5:18 pm


Return to QNX2 and QNX4

Who is online

Users browsing this forum: No registered users and 1 guest