N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

General Profiling Information

Introduction
The osProfileInit, osProfileStart, osProfileStop, and osProfileFlush functions provide execution time profiling for disjoint text spaces. Profiling provides CPU-use statistics by profiling the amount of CPU time expended by a program in disjoint text spaces.

Profiling generates the statistics by creating an execution histogram for a current process. The histogram is defined for a list of regions of program code to be profiled specified by members of the profp array: profp[0], profp[1], ..., profp[profcnt-1]. The host-side application gperf copies the histogram data to the host and prints a report detailing the relative time spent processing each function.

OSProf Structure's Field Elements
The OSProf data structure has the following elements:
  • u16 *histo_base - Pointer to an array of u16 counters.
  • u32 histo_size - Number of counters in the histo_base buffer. Profiling requires one counter for each 32-bit word in the segment. This provides one counter for each instruction.
  • u32 *text_start - Pointer to the first instruction in the segment to be profiled.
  • u32 *text_end - Pointer to the last instruction in the segment to be profiled.
Each OSprof entry specifies a region of text space that needs to be profiled. If an instruction falls outside the bounds specified by the profp array, an internal 32-bit overflow counter is incremented. The histogram counters are always 16 bits. There is no protection for the overflow of these counters.

Errors
The following errors are reported when you are using the debug library:
  • ERR_OSPROFILEINIT_STR - Profile counter is running, call osProfileStop before initializing.
  • ERR_OSPROFILEINIT_CNT - The profcnt argument is an illegal value.
  • ERR_OSPROFILEINIT_ALN - The histo_base pointer must be 32-bit aligned.
  • ERR_OSPROFILEINIT_ORD - The text_start element of the OSProf structure is greater than or equal to the text_end element.
  • ERR_OSPROFILEINIT_SIZ - The histo_size element of the OSProf structure is an illegal size.
  • ERR_OSPROFILESTART_TIME - The microseconds argument is less than PROF_MIN_INTERVAL.
  • ERR_OSPROFILESTART_FLAG - Profiling has already been started.
  • ERR_OSPROFILESTOP_FLAG - Profiling has already been stopped.
  • ERR_OSPROFILESTOP_TIMER - No profile timer to stop.
Possible Problems
Calling osProfileFlush when gperf is not running can cause unexpected results later.

The gperf tool (and thus profiling) does not work with programs that have functions that have been rearranged in the executable objects for optimization.

Currently, profiling only supports 16-bit counters.

Profiling is not available in the libultra_rom library.

There is no check for overlapping text segments in the OSProf array.

See Also
osProfileInit
osProfileStart
osProfileStop
osProfileFlush
gperf
makerom (IRIX 5.3)
makerom (IRIX 6.x)



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998