MCPcopy Create free account
hub / github.com/F-Stack/f-stack / startguprof

Function startguprof

freebsd/i386/i386/prof_machdep.c:313–365  ·  view source on GitHub ↗
(gp)

Source from the content-addressed store, hash-verified

311 */
312
313void
314startguprof(gp)
315 struct gmonparam *gp;
316{
317#if defined(I586_CPU) || defined(I686_CPU)
318 uint64_t freq;
319
320 freq = atomic_load_acq_64(&tsc_freq);
321 if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED) {
322 if (freq != 0 && mp_ncpus == 1)
323 cputime_clock = CPUTIME_CLOCK_TSC;
324 else
325 cputime_clock = CPUTIME_CLOCK_I8254;
326 }
327 if (cputime_clock == CPUTIME_CLOCK_TSC) {
328 gp->profrate = freq >> 1;
329 cputime_prof_active = 1;
330 } else
331 gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT;
332#if defined(PERFMON) && defined(I586_PMC_GUPROF)
333 if (cputime_clock == CPUTIME_CLOCK_I586_PMC) {
334 if (perfmon_avail() &&
335 perfmon_setup(0, cputime_clock_pmc_conf) == 0) {
336 if (perfmon_start(0) != 0)
337 perfmon_fini(0);
338 else {
339 /* XXX 1 event == 1 us. */
340 gp->profrate = 1000000;
341
342 saved_gmp = *gp;
343
344 /* Zap overheads. They are invalid. */
345 gp->cputime_overhead = 0;
346 gp->mcount_overhead = 0;
347 gp->mcount_post_overhead = 0;
348 gp->mcount_pre_overhead = 0;
349 gp->mexitcount_overhead = 0;
350 gp->mexitcount_post_overhead = 0;
351 gp->mexitcount_pre_overhead = 0;
352
353 cputime_clock_pmc_init = TRUE;
354 }
355 }
356 }
357#endif /* PERFMON && I586_PMC_GUPROF */
358#else /* !(I586_CPU || I686_CPU) */
359 if (cputime_clock == CPUTIME_CLOCK_UNINITIALIZED)
360 cputime_clock = CPUTIME_CLOCK_I8254;
361 gp->profrate = i8254_freq << CPUTIME_CLOCK_I8254_SHIFT;
362#endif /* I586_CPU || I686_CPU */
363 cputime_bias = 0;
364 cputime();
365}
366
367void
368stopguprof(gp)

Callers 2

kmstartupFunction · 0.50
sysctl_kern_profFunction · 0.50

Calls 6

perfmon_availFunction · 0.85
perfmon_setupFunction · 0.85
perfmon_startFunction · 0.85
perfmon_finiFunction · 0.85
cputimeFunction · 0.70
atomic_load_acq_64Function · 0.50

Tested by

no test coverage detected