Lines Matching refs:pv
106 * If DEBUG_PROFILE is defined, set pv->debug to 1.
234 static void *_profile_md_acontext(struct profile_vars *pv,
286 void _profile_error(struct profile_vars *pv)
298 _profile_md_acontext(struct profile_vars *pv,
314 _profile_printf("_profile_md_acontext: pv= 0x%lx, ptr= 0x%lx, len= %6ld, type= %d\n",
315 (long)pv,
322 context->next = pv->acontext[type];
334 pv->stats.num_context[type]++;
335 pv->stats.wasted[type] += plist->bytes_free;
336 pv->stats.overhead[type] += len - plist->bytes_free;
339 pv->acontext[type] = context;
351 _profile_md_init(struct profile_vars *pv,
355 size_t page_size = pv->page_size;
377 _profile_printf("_profile_md_init: pv = 0x%lx, type = %d, alloc = %d\n",
378 (long) pv,
396 pv->md.save_mcount_ptr = _gprof_mcount;
399 pv->md.save_mcount_ptr = _prof_mcount;
402 pv->md.save_mcount_ptr = _dummy_mcount;
405 pv->vars_size = sizeof(struct profile_vars);
406 pv->plist_size = sizeof(struct page_list);
407 pv->acontext_size = sizeof(struct alloc_context);
408 pv->callback_size = sizeof(struct callback);
409 pv->major_version = PROFILE_MAJOR_VERSION;
410 pv->minor_version = PROFILE_MINOR_VERSION;
411 pv->type = type;
412 pv->do_profile = 1;
413 pv->use_dci = 1;
414 pv->use_profil = 1;
415 pv->output_uarea = 1;
416 pv->output_stats = (prof_flag_t) _profile_do_stats;
417 pv->output_clock = 1;
418 pv->multiple_sections = 1;
419 pv->init_format = 0;
420 pv->bogus_func = _bogus_function;
423 pv->debug = 1;
426 if (!pv->error_msg) {
427 pv->error_msg = "error in profiling";
430 if (!pv->page_size) {
431 pv->page_size = 4096;
434 pv->stats.stats_size = sizeof(struct profile_stats);
435 pv->stats.major_version = PROFILE_MAJOR_VERSION;
436 pv->stats.minor_version = PROFILE_MINOR_VERSION;
438 pv->md.md_size = sizeof(struct profile_md);
439 pv->md.major_version = PROFILE_MAJOR_VERSION;
440 pv->md.minor_version = PROFILE_MINOR_VERSION;
441 pv->md.hash_size = _profile_hash_size;
442 pv->md.num_cache = MAX_CACHE;
443 pv->md.mcount_ptr_ptr = &_mcount_ptr;
444 pv->md.dummy_ptr = &_gprof_dummy;
445 pv->md.alloc_pages = _profile_alloc_pages;
449 pv->acontext[ac] = (struct alloc_context *)0;
462 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
463 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
497 ptr = _profile_md_acontext(pv, ptr, extra_arc_size, ACONTEXT_GPROF);
498 ptr = _profile_md_acontext(pv, ptr, extra_func_size, ACONTEXT_GFUNC);
500 ptr = _profile_md_acontext(pv, ptr, arc_size, ACONTEXT_GPROF);
501 ptr = _profile_md_acontext(pv, ptr, func_size, ACONTEXT_GFUNC);
502 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
503 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
506 pv->md.hash_ptr = (struct hasharc **) _profile_alloc(pv, hash_size, ACONTEXT_MISC);
518 ptr = _profile_md_acontext(pv, ptr, func_size, ACONTEXT_PROF);
519 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
520 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
552 _profile_reset_alloc(struct profile_vars *pv, acontext_type_t ac)
557 for (aptr = pv->acontext[ac];
582 _profile_reset(struct profile_vars *pv)
588 if (pv->active) {
593 for (aptr = pv->acontext[ACONTEXT_GFUNC];
611 _profile_reset_alloc(pv, ACONTEXT_GPROF);
612 _profile_reset_alloc(pv, ACONTEXT_GFUNC);
613 _profile_reset_alloc(pv, ACONTEXT_PROF);
615 memset((void *)pv->profil_buf, '\0', pv->profil_info.profil_len);
616 memset((void *)pv->md.hash_ptr, '\0', pv->md.hash_size * sizeof(struct hasharc *));
617 memset((void *)&pv->stats, '\0', sizeof(pv->stats));
619 pv->stats.stats_size = sizeof(struct profile_stats);
620 pv->stats.major_version = PROFILE_MAJOR_VERSION;
621 pv->stats.minor_version = PROFILE_MINOR_VERSION;
623 if (pv->active) {
635 _gprof_write(struct profile_vars *pv, struct callback *callback_ptr)
643 for (aptr = pv->acontext[ACONTEXT_GPROF];
655 if (pv->check_funcs) {
656 if (arc.frompc < pv->profil_info.lowpc ||
657 arc.frompc > pv->profil_info.highpc) {
659 arc.frompc = (prof_uptrint_t)pv->bogus_func;
662 if (arc.selfpc < pv->profil_info.lowpc ||
663 arc.selfpc > pv->profil_info.highpc) {
665 arc.selfpc = (prof_uptrint_t)pv->bogus_func;
673 if ((*pv->fwrite_func)((void *)&arc,
676 pv->stream) != 1) {
678 _profile_error(pv);
697 _prof_write(struct profile_vars *pv, struct callback *callback_ptr)
709 for (aptr = pv->acontext[ACONTEXT_PROF];
725 if ((*pv->fwrite_func)((void *)&prof_st,
728 pv->stream) != 1) {
730 _profile_error(pv);
740 for (aptr = pv->acontext[ACONTEXT_GFUNC];
756 if ((*pv->fwrite_func)((void *)&prof_st,
759 pv->stream) != 1) {
761 _profile_error(pv);
781 _profile_update_stats(struct profile_vars *pv)
792 pv->stats.buckets[i] = 0;
795 pv->stats.hash_buckets = 0;
797 if (pv->md.hash_ptr) {
798 for (i = 0; i < pv->md.hash_size; i++) {
802 for (hptr = pv->md.hash_ptr[i]; hptr; hptr = hptr->next) {
806 pv->stats.buckets[ (nbuckets < MAX_BUCKETS) ? nbuckets : MAX_BUCKETS ]++;
807 if (pv->stats.hash_buckets < nbuckets) {
808 pv->stats.hash_buckets = nbuckets;
814 if (pv->check_funcs) {
815 pv->stats.bogus_count = 0;
817 for (aptr = pv->acontext[ACONTEXT_GPROF];
828 if (hptr->arc.frompc < pv->profil_info.lowpc ||
829 hptr->arc.frompc > pv->profil_info.highpc) {
830 pv->stats.bogus_count++;
833 if (hptr->arc.selfpc < pv->profil_info.lowpc ||
834 hptr->arc.selfpc > pv->profil_info.highpc) {
835 pv->stats.bogus_count++;
843 PROF_ULONG_TO_CNT(pv->stats.prof_overflow, 0);
844 PROF_ULONG_TO_CNT(pv->stats.gprof_overflow, 0);
846 for (aptr = pv->acontext[ACONTEXT_GPROF];
856 PROF_CNT_ADD(pv->stats.gprof_overflow, hptr->overflow);
861 for (aptr = pv->acontext[ACONTEXT_PROF];
871 PROF_CNT_ADD(pv->stats.prof_overflow, pptr->overflow);
876 for (aptr = pv->acontext[ACONTEXT_GFUNC];
886 PROF_CNT_ADD(pv->stats.prof_overflow, fptr->prof.overflow);
892 lptr = (LHISTCOUNTER *)pv->profil_buf;
894 if (pv->use_profil &&
895 pv->profil_info.counter_size == sizeof(LHISTCOUNTER) &&
898 PROF_ULONG_TO_CNT(pv->stats.overflow_ticks, 0);
899 for (i = 0; i < pv->stats.profil_buckets; i++) {
900 PROF_CNT_ADD(pv->stats.overflow_ticks, lptr[i].high);