1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2<HTML>
3<HEAD>
4<META http-equiv="Content-Type" content="text/html; charset=windows-1252">
5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows">
6<META http-equiv="Content-Style-Type" content="text/css">
7<TITLE>OS_InitFunctionCost</TITLE>
8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css">
9</HEAD>
10<BODY>
11<H1 align="left">OS_InitFunctionCost <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1>
12<H2>Syntax</H2>
13<DL>
14<DD><CODE>#include &lt;nitro/os.h&gt;</CODE><BR> <BR> <CODE>void OS_InitFunctionCost( void* buf, u32 size );</CODE>
15</DL>
16<H2>Arguments</H2>
17<TABLE border="1">
18  <TBODY>
19    <TR>
20<TD><CODE>buf</CODE></TD>
21<TD>Function cost calculation buffer</TD>
22    </TR>
23    <TR>
24<TD><CODE>size</CODE></TD>
25<TD>Size of the function cost calculation buffer.</TD>
26    </TR>
27  </TBODY>
28</TABLE>
29<H2>Return Values</H2>
30<P>None.</P>
31<H2>Description</H2>
32<P>Sets the buffer that will be used for function cost calculation, and begins the function cost calculation. After function cost calculation settings are made by calling this function, calculation status will be Enabled.(This is the status after the <A href="OS_EnableFunctionCost.html"><CODE>OS_EnableFunctionCost</CODE></A> function is called.)</P>
33<P>In order for a function to be calculated, it must be compiled with the <CODE>profile</CODE> feature on. (When you compile with <CODE>TWL_PROFILE=TRUE</CODE>, at compile time the <CODE>-profile</CODE> option will be attached, and the profile feature will be on.)</P>
34<P>To enable features that are related to function cost calculation, at link time you must include <CODE>libos.FUNCTIONCOST.a</CODE> (in the thumb version <CODE>libos.FUNCTIONCOST.thumb.a</CODE>). To do this, specify <CODE>TWL_PROFILE_TYPE=FUNCTIONCOST</CODE> as a <CODE>make</CODE> option. You may also write it in the <CODE>makefile</CODE>. However, in the final ROM version (FINALROM) library, it will not do anything.</P>
35<P>An information header used for function cost calculations (<CODE>sizeof(OSFunctionCostInfo) - sizeof(OSFunctionCost)</CODE> bytes) is stored in the front of the buffer <CODE>buf</CODE>. When the function is called, the size of information stored will be <CODE>sizeof(OSFunctionCost)</CODE> bytes.</P>
36<P>If you are using a thread system, buffers are independent for each thread. Therefore, if you want to store cost calculations, you will have to define a separate buffer in each thread.</P>
37<P>To aggregate and display calculation results, aggregate them with the <A href="OS_CalcStatistics.html"><CODE>OS_CalcStatistics</CODE></A> or <A href="OS_CalcThreadStatistics.html"><CODE>OS_CalcThreadStatistics</CODE></A> function, then call the <A href="OS_DumpStatistics.html"><CODE>OS_DumpStatistics</CODE></A> function.</P>
38
39<H2>See Also</H2>
40<P><A href="OS_CalcStatistics.html"><CODE>OS_CalcStatistics</CODE></A><BR> <A href="OS_CalcThreadStatistics.html"><CODE>OS_CalcThreadStatics</CODE></A><BR> <A href="OS_DumpStatistics.html"><CODE>OS_DumpStatistics</CODE></A></P>
41<H2>Revision History</H2>
42<P>2004/06/02 Changed description of the <CODE>make</CODE> options <BR>2004/05/18 Initial version.</P>
43<hr><p>CONFIDENTIAL</p></body>
44</HTML>