FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

cpu and bus speed report

3 posters

Go down

cpu and bus speed report Empty cpu and bus speed report

Post  zzajin Thu Nov 06, 2008 10:37 pm

Apparently 1st and 2nd gen touch devices have different cpu and bus speeds: 412Mhz cpu with 103Mhz bus and 532Mhz cpu with 133Mhz bus respectively.

During init sio2 gives a bit of a report. Here is some code for cpu and bus speeds that might be of use to someone.


Code:

   
#include <sys/sysctl.h>


   int mib[6] = { 0 };
   size_t length = sizeof( int );
   
   int cpuF = 0;
   int busF = 0;
   
   // Get cpu speed
   mib[0] = CTL_HW;
   mib[1] = HW_CPU_FREQ;
   sysctl( mib, 2, &cpuF, &length, 0,0 );
   
   
   // Get bus speed
   mib[0] = CTL_HW;
   mib[1] = HW_BUS_FREQ;
   sysctl( mib, 2, &busF, &length, 0,0 );
   
   
   printf( "\nCPU speed: %d Mhz\n", cpuF/1000000 );
   printf( "Bus speed: %d Mhz\n", busF/1000000 );



zzajin

Posts : 81
Join date : 2008-10-14

Back to top Go down

cpu and bus speed report Empty Re: cpu and bus speed report

Post  sio2interactive Sat Nov 08, 2008 1:58 am

Once again tks for the tip man! Will integrate the code at init time Wink


Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

cpu and bus speed report Empty Re: cpu and bus speed report

Post  matt Sat Nov 08, 2008 1:21 pm

Then it would be probably nice to have information about available memory, too. I dump this information every five seconds in debug build just to have an idea where the memory goes even when not explicitly hunting for memory leaks.

Code:
   int pagesize;
   mib[ 0 ] = CTL_HW;
   mib[ 1 ] = HW_PAGESIZE;
   size_t length = sizeof(pagesize);
   if( sysctl( mib, 2, &pagesize, &length, NULL, 0 ) < 0 ) {
      // Failure!
      return;
   }
   mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
   vm_statistics_data_t vmstat;
   if( host_statistics( mach_host_self(), HOST_VM_INFO, (host_info_t) &vmstat, &count ) != KERN_SUCCESS ) {
      // Failure!
      return;
   }
   NSLog( @"Free memory: %8d bytes", vmstat.free_count * pagesize );

Best,
Matt

matt

Posts : 155
Join date : 2008-09-30

http://elfrun.net

Back to top Go down

cpu and bus speed report Empty Re: cpu and bus speed report

Post  sio2interactive Sat Nov 08, 2008 4:02 pm

For memory leaks, you can use instruments, or sio2_memory, that will detect and report you the leaks as well as where in your code this memory have been initialized and the total memory currently in use...

Cheers,
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 45
Location : Shanghai

http://sio2interactive.com

Back to top Go down

cpu and bus speed report Empty Re: cpu and bus speed report

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum