MONITOR(3C) UNIX Programmer's Manual MONITOR(3C) NAME monitor - prepare execution profile SYNOPSIS monitor (lowpc, highpc, buffer, bufsize, nfunc) int (*lowpc)( ), (*highpc)( ); short buffer[ ]; int bufsize, nfunc; HP-UX COMPATIBILITY Level: HP-UX/STANDARD Origin: System III Remarks: _M_o_n_i_t_o_r is implemented on the Series 200 only. DESCRIPTION An executable program created by cc -p automatically includes calls for _m_o_n_i_t_o_r with default parameters. _M_o_n_i_t_o_r needn't be called explicitly except to gain fine control over profiling. _M_o_n_i_t_o_r is an interface to _p_r_o_f_i_l(2). _L_o_w_p_c and _h_i_g_h_p_c are the addresses of two functions. _B_u_f_f_e_r is the address of a (user supplied) array of _b_u_f_s_i_z_e short integers. _M_o_n_i_t_o_r arranges to record a histogram of periodically sampled values of the program counter, and of counts of calls of certain functions, in the buffer. The lowest address sam- pled is that of _l_o_w_p_c and the highest is just below _h_i_g_h_p_c. At most _n_f_u_n_c call counts can be kept. Only calls of func- tions compiled with the profiling option -p of _c_c(1) are recorded. For the results to be significant, especially where there are small, heavily used routines, it is sug- gested that the buffer be no more than a few times smaller than the range of locations sampled. To profile the entire program, it is sufficient to use extern etext(); ... monitor(2, etext, buf, bufsize, nfunc); _E_t_e_x_t lies just above all the program text (see _e_n_d(3C)). To stop execution monitoring and write the results on the file mon.out, use monitor(0); _P_r_o_f(1) can then be used to examine the results. FILES mon.out SEE ALSO cc(1), prof(1), profil(2).