Return an entry from the system page
#include <sys/syspage.h> #define SYSPAGE_ENTRY( entry )...
libc
The SYSPAGE_ENTRY() macro returns a pointer to the specified entry in the system page.
The best way to reference the system page is via the kernel calls and POSIX cover functions. If there isn't a function to access the information you need, use SYSPAGE_ENTRY() instead of referencing the _syspage_ptr variable directly. For information in the CPU-specific part of the syspage_entry structure, use SYSPAGE_CPU_ENTRY().
Currently, the only entry you're likely to access with SYSPAGE_ENTRY() is:
| Variable | Type | Description |
|---|---|---|
| boot_time | unsigned long | The time, in seconds, since the Unix Epoch (00:00:00 January 1, 1970 Coordinated Universal Time (UTC)) when this system was booted. |
| cycles_per_sec | uint64_t | The number of CPU clock cycles per second for this system (see ClockCycles() for more information). |
A pointer to the structure for the given entry.
#include <sys/neutrino.h>
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/syspage.h>
int main( void )
{
uint64_t cps, cycle1, cycle2, ncycles;
float sec;
/* snap the time */
cycle1=ClockCycles( );
/* do something */
printf("poo\n");
/* snap the time again */
cycle2=ClockCycles( );
ncycles=cycle2-cycle1;
printf("%lld cycles elapsed \n", ncycles);
/* find out how many cycles per second */
cps = SYSPAGE_ENTRY(qtime)->cycles_per_sec;
printf( "This system has %lld cycles/sec.\n",cps );
sec=(float)ncycles/cps;
printf("The cycles in seconds is %f \n",sec);
return EXIT_SUCCESS;
}
| Safety: | |
|---|---|
| Cancellation point | No |
| Interrupt handler | Yes |
| Signal handler | Yes |
| Thread | Yes |
SYSPAGE_ENTRY() is a macro.
ClockCycles(), SYSPAGE_CPU_ENTRY()
Customizing Image Startup Programs chapter of the Building Embedded Systems guide