MONITOR(3) UNIX Programmer's Manual MONITOR(3) NAME monitor - prepare execution profile SYNOPSIS monitor(lowpc, highpc, buffer, bufsize, nfunc) int (*lowpc)( ), (*highpc)( ); short buffer[ ]; 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((int)2, etext, buf, bufsize, nfunc); _E_t_e_x_t lies just above all the program text, see _e_n_d(3). To stop execution monitoring and write the results on the file _m_o_n._o_u_t, use monitor(0); then _p_r_o_f(1) can be used to examine the results. FILES mon.out SEE ALSO cc(1), prof(1), profil(2) Printed 5/17/83 1