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

📄 monitor.3

📁 <B>Digital的Unix操作系统VAX 4.2源码</B>
💻 3
字号:
.TH monitor 3 RISC.SH Namemonitor, monstartup, moncontrol \- prepare execution profile.SH Synopsis.nf.B monitor(lowpc, highpc, buffer, bufsize, nfunc).B int (*lowpc)(), (*highpc)();.B short buffer[];.sp.B monstartup(lowpc, highpc).B int (*lowpc)(), (*highpc)();.sp.B moncontrol(mode).fi.SH DescriptionThese functions use the system call.MS profil 2to control program-counter sampling.  Using the option.B \-pwhen compiling or linking a programautomatically generates calls to these functions.  You do need not to call these functions explicitly unless you want more control..PPTypically, you would call either.PN monitoror.PN monstartupto initialize pc-sampling and enable it; call.PN moncontrolto disable or reenable it; and call.PN monitorat the end of execution to disable sampling and record the samples ina file..PPYour initial call to.PN monitorenables pc-sampling.The parameters.I lowpcand.I highpcspecify the range of addresses to be sampled.  The lowest address is that of.I lowpcand the highest is just below.IR highpc .The .I bufferparameteris the address of a (user allocated) array of.I bufsizeshort integers, which holds a record of the samples; for best results,the buffer should not be less than a few times smaller than the rangeof addresses sampled.The.I nfuncparameteris ignored..PPThe environment variable PROFDIR determines the name of the output fileand whether pc-sampling takes place: if it is not set, the file is namedmon.out; if set to the empty string, no pc-sampling occurs; if set to anon-empty string, the file is named string/pid.progname, where pidis the process id of the executing program and progname is the program'sname as it appears in argv[0]. The subdirectory string must alreadyexist..PPTo profile the entire program, use the following:.PP.nf	\f(CWextern eprol(), etext();	. . .	monitor(eprol, etext, buf, bufsize, 0);\fR.fi.PPThe routine .PN eprollies just below the user program text, and.PN etextlies just above it, as described in.MS end 3 .(Because the user program does not necessarily start at a low memory address,using a small number in place of .PN eprolis dangerous)..PPThe .PN monstartuproutineis an alternate form of.PN monitorthat calls.PN sbrk (see .MS brk 2 )for you to allocate the buffer..PPThe function.PN moncontrolselectively disables and re-enables pc-sampling within a program, allowingyou to measure the cost of particular operations.The function.PN moncontrol(0)disables pc-sampling, and.PN moncontrol(1)reenables it..PPTo stop execution monitoring and write the results in the output file, usethe following:.PP	\f(CWmonitor(0);\fR.PP.SH Files.ta \w'libprof1.a    'u\fImon.out\fR	default name for output file.br\fIlibprof1.a\fR	routines for pc-sampling.br.SH See Alsocc(1), ld(1), profil(2), brk(2) 

⌨️ 快捷键说明

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