# OS_DumpStatistics

## Syntax

  `#include <nitro/os.h>`
  `void OS_DumpStatistics( void* statBuf );`

## Arguments

statBuf | Function cost statistics buffer

## Return Values

None.

## Description

Displays the contents of the function cost statistics buffer.

It uses the `OS_Printf` function to output the contents of the function cost statistics buffer, which accumulates the results of calculating function costs.

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 can also write it in the `makefile`. However, in the final ROM version (FINALROM) library, it will not do anything.

> Display Example:

> > `---- functionCost statistics
> > ``test1: count 1, cost 20
> > test2: count 3, cost 140
> > test3: count 4, cost 132
> > `

> The accumulated results are displayed in a row from the left: function name, number of times the function has been called, time cost required to execute inside the function. From this, we can see that a function named `test1()` was called once, and the time cost was 20. (The time cost unit is the same unit that is used with ticks: 1/64th of the system clock.) Likewise, `test2()` was called 3 times, and the total time cost was 140; `test3()` was called 4 times, and the total time cost was 132.

As in the display of accumulated results, if the certain display of all information has priority over speed, we recommend temporarily setting the display to blocking mode. See `OS_SetPrintBlockingMode` for further details.

## See Also

`OS_InitStatistics`
`OS_SetPrintBlockingMode`

## Revision History

2009/04/03 Added a note on blocking mode.
2004/05/19 Initial version.

CONFIDENTIAL