# OS_InitStatistics

## Syntax

  `#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 `TWL_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 ( `sizeof(OSFunctionCostStatisticsInfo) - sizeof(OSFunctionCostStatistics)` bytes, which includes the buffer's end position, the current pointer, and so on) is stored in the front of the buffer buf. The rest of the buffer is packed from the front with the statistics information.

Use `OS_CalcStatistics()` or `OS_CalcThreadStatistics()` to aggregate the contents of a function cost calculation buffer into the function cost statistics buffer. Then use `OS_DumpStatistics()` to display those 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

2004/05/18 Initial version.

CONFIDENTIAL