Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
New Contributor
jfpoole
Posts: 2
Registered: ‎02-02-2013
My Device: Dev Alpha
My Carrier: AT&T

Querying processor Information

Hi folks,

 

Does anyone know how (or even if it's possible) to query processor information from the OS?  I've looked through the documentation but services like Device Information (deviceinfo.h) don't seem to provide the necessary functionality.  QNX's pidin utility looks like it can provide this information, but I have no idea what API calls it makes to query the information.

 

Any suggestions or pointers?

 

Thanks,

John

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Querying processor Information

There should be some standard Posix APIs for this, but I'm not familiar with the details.

You can always just run "uname -a" or something like it, using a system() call, and capture the output and parse it.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Developer
indy2718
Posts: 36
Registered: ‎01-16-2013
My Device: Z10
My Carrier: Telus

Re: Querying processor Information

For BB10 QNX: have your app open and read "/proc/cpuinfo" as a text file.   Not sure about the other BB operating systems.

Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 162.54
Features : swp half thumb fastmult vfp edsp thumbee neon
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x0
CPU part : 0x00f
CPU revision : 2

Please use plain text.
New Contributor
JonathanLennox
Posts: 5
Registered: ‎03-28-2013
My Device: BlackBerry 10 Dev Alpha
My Carrier: none

Re: Querying processor Information

I don't see any such file -- at least when I'm using the SSH session from within Momentics (I haven't tried from within an app yet).  I see other files in /proc and /dev, but not that one.

 

$ cat /proc/cpuinfo
/proc/cpuinfo: No such file or directory
$ uname -a
QNX BLACKBERRY-15BB 8.0.0 2013/01/27-14:00:10EST OMAP4460_ES1.1_HS_Colt_Rev:06 armle

 

OS reports as Blackberry 10 OS Version 10.9.10.35.

 

Am I missing something?

Please use plain text.
Developer
indy2718
Posts: 36
Registered: ‎01-16-2013
My Device: Z10
My Carrier: Telus

Re: Querying processor Information

Guess it's non standard then.  I'm using a retail Canadian Z10

$ cat /proc/cpuinfo
Processor : ARMv7 Processor rev 2 (v7l)
BogoMIPS : 162.54
Features : swp half thumb fastmult vfp edsp thumbee neon
CPU implementer : 0x51
CPU architecture: 7
CPU variant : 0x0
CPU part : 0x00f
CPU revision : 2
$ uname -a
QNX BLACKBERRY-E5F8 8.0.0 2013/02/18-20:45:30EST MSM8960_V3.2.1_F_R070_Rev:19 armle

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Querying processor Information

I suspect that might be present only if you have Android apps installed. Wild speculation, but at one point I didn't have it either, but now I do.

I don't think one should count on /proc/cpuinfo, but uname is always present.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Regular Contributor
janetsa
Posts: 66
Registered: ‎11-13-2010
My Device: Not Specified

Re: Querying processor Information

I think that the OP is the guy behind Geekbench and he still hasn't figured out how to differentiate between OMAP4470 Z10 and Qualcomm S4 Z10.  It would be nice for RIM to give him a solution.

 

https://twitter.com/jfpoole/status/315225493819502592

Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 666
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: Querying processor Information

/proc/cpuinfo is definitely an android-ism.  it is not part of QNX per se.

 

You should be able to use uname -m for cpu rev.

The source for uname.c pretty much just calls uname(), which you will find in sys/utsname.h

Please use plain text.
Developer
laliux
Posts: 73
Registered: ‎07-16-2009
My Device: Bold

Re: Querying processor Information

What about the HardwareInfo class?

 

#include <bb/device/HardwareInfo>

 

 

http://developer.blackberry.com/cascades/reference/bb__device__hardwareinfo.html

 

 

Regards

Please use plain text.
Developer
borceg
Posts: 671
Registered: ‎03-21-2012
My Device: BlackBerry PlayBook 16GB
My Carrier: Vip

Re: Querying processor Information

HardwareInfo class doesn't provide CPU related information.

Please use plain text.