# OS_InitStatistics

## C Specification

      #include

      void OS_InitStatistics( void* statBuf, u32 size );

## Description

This function initializes the function cost statistics buffer.

To enable this function, at link time you must include `libos.FUNCTIONCOST.a` (in the thumb version `libos.FUNCTIONCOST.thumb.a`). To do this, specify `NITRO_PROFILE_TYPE=FUNCTIONCOST` as a `make` option. You may also write it in the `makefile`. This function works because the OS library is created with the `NITRO_PROFILE_TYPE=FUNCTIONCOST` option, and because the using side also similarly sets the `NITRO_PROFILE_TYPE=FUNCTIONCOST` option. However, in the final ROM version (FINALROM) library, it will not do anything.

Header information for (the number of bytes in `sizeof(OSFunctionCostStatisticsInfo) - sizeof(OSFunctionCostStatistics)` which includes the buffer's end position, the currently used pointer, etc) is stored in the front of the buffer buf. Statistical information is written in the remainder.

Use `OS_CalcStatistics()` or `OS_CalcThreadStatistics()` to accumulate the contents from a function cost calculation buffer into the function cost statistics buffer. The use `OS_DumpStatistics()` to display the contents. You can accumulate the contents of multiple function cost calculation buffers into one function cost statistics buffer.

## Arguments

`statBuf` | Function cost statistics buffer
`size` | Size of the function cost statistics buffer

## Return Values

None

## See Also

`OS_DumpStatistics, OS_CalcStatistics, OS_CalcThreadStatistics`

## Revision History

05/18/2004 Initial version