# OS_InitStatistics

## C Specification

  `#include <nitro/os.h>`
  `void OS_InitStatistics( void* statBuf, u32 size );`

## Arguments

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

## Return Values

None.

## 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`. 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.

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

## See Also

`OS_DumpStatistics, OS_CalcStatistics, OS_CalcThreadStatistics
`

## Revision History

05/18/2004 Initial Version