⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 monitor.3

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 3
字号:
.\" SCCSID: @(#)monitor.3	8.2	1/28/91.TH monitor 3 VAX.SH Namemonitor, monstartup, moncontrol \- prepare execution profile.SH Syntax.nf.B void monitor(lowpc, highpc, buffer, bufsize, nfunc).B int (*lowpc)(), (*highpc)();.B short buffer[];.sp.B void monstartup(lowpc, highpc).B int (*lowpc)(), (*highpc)();.sp.B void moncontrol(mode).fi.SH Description.NXR "monitor subroutine".NXR "monstartup subroutine".NXR "moncontrol subroutine".NXR "program" "profiling"There are two different forms of monitoring available:An executable program created by:.EX cc \-p . . ..EE.PPautomatically includes calls for the .MS prof 1monitor and includes an initial call to its start-up routine.PN monstartupwith default parameters;.PN monitorneed not be called explicitly except to gain fine control over profil buffer allocation.An executable program created by:.EXcc \-pg . . ..EE.PPautomatically includes calls for the .MS gprof 1monitor..PPThe.PN monstartupis a high level interface to .MS profil 2 .The.I lowpcand.I highpcspecify the address range that is to be sampled; the lowest address sampledis that of.I lowpcand the highest is just below.IR highpc .The.PN monstartupsubroutine allocates space using .MS sbrk 2and passes it to.PN monitor(see below) to record a histogram of periodically sampled values ofthe program counter,and of counts of calls of certain functions, in the buffer.Only calls of functions compiled with the profiling option.B \-pof .MS cc 1are recorded..PPTo profile the entire program, it is sufficient to use.EXextern etext();. . .monstartup((int) 2, etext);.EEThe.I etextlies just above all the program text, see end(3)..PPTo stop execution monitoring and write the results on the file.PN mon.out ,use.EXmonitor(0);.EEthen .MS prof 1can be used to examine the results..PPThe.PN moncontrolsubroutine is used to selectively control profiling within a program.This works with either .MS prof 1 or .MS gprof 1type profiling.When the program starts, profiling begins.To stop the collection of histogram ticks and call counts usemoncontrol(0);to resume the collection of histogram ticks and call counts usemoncontrol(1).This allows the cost of particular operations to be measured.Note that an output file will be produced upon program exitregardless of the state of .PN moncontrol ..PPThe.PN monitorsubroutineis a low level interface to .MS profil 2 .The.I lowpcand.I highpcare the addresses of two functions;.I bufferis the address of a (user supplied) array of.I bufsizeshort integers.  At most.I nfunccall counts can be kept.For the results to be significant,especially where there are small, heavilyused routines, it is suggested that the buffer be no morethan a few times smaller than the range of locations sampled.The.PN monitorsubroutinedivides the buffer into space to record the histogramof program counter samples over the range.I lowpcto.IR highpc ,and space to record call counts of functions compiled with the .B \-poption to .MS cc 1 ..PPTo profile the entire program, it is sufficient to use.EXextern etext();. . .monitor((int) 2, etext, buf, bufsize, nfunc);.EE.SH Filesmon.out.SH See Alsocc(1), gprof(1), prof(1), profil(2), sbrk(2)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -