Lines Matching defs:pv
106 * If DEBUG_PROFILE is defined, set pv->debug to 1.
234 static void *_profile_md_acontext(struct profile_vars *pv,
292 void _profile_error(struct profile_vars *pv)
304 _profile_md_acontext(struct profile_vars *pv,
320 _profile_printf("_profile_md_acontext: pv= 0x%lx, ptr= 0x%lx, len= %6ld, type= %d\n",
321 (long)pv,
328 context->next = pv->acontext[type];
340 pv->stats.num_context[type]++;
341 pv->stats.wasted[type] += plist->bytes_free;
342 pv->stats.overhead[type] += len - plist->bytes_free;
345 pv->acontext[type] = context;
357 _profile_md_init(struct profile_vars *pv,
361 size_t page_size = pv->page_size;
383 _profile_printf("_profile_md_init: pv = 0x%lx, type = %d, alloc = %d\n",
384 (long) pv,
402 pv->md.save_mcount_ptr = _gprof_mcount;
405 pv->md.save_mcount_ptr = _prof_mcount;
408 pv->md.save_mcount_ptr = _dummy_mcount;
411 pv->vars_size = sizeof(struct profile_vars);
412 pv->plist_size = sizeof(struct page_list);
413 pv->acontext_size = sizeof(struct alloc_context);
414 pv->callback_size = sizeof(struct callback);
415 pv->major_version = PROFILE_MAJOR_VERSION;
416 pv->minor_version = PROFILE_MINOR_VERSION;
417 pv->type = type;
418 pv->do_profile = 1;
419 pv->use_dci = 1;
420 pv->use_profil = 1;
421 pv->output_uarea = 1;
422 pv->output_stats = (prof_flag_t) _profile_do_stats;
423 pv->output_clock = 1;
424 pv->multiple_sections = 1;
425 pv->init_format = 0;
426 pv->bogus_func = _bogus_function;
429 pv->debug = 1;
432 if (!pv->error_msg) {
433 pv->error_msg = "error in profiling";
436 if (!pv->page_size) {
437 pv->page_size = 4096;
440 pv->stats.stats_size = sizeof(struct profile_stats);
441 pv->stats.major_version = PROFILE_MAJOR_VERSION;
442 pv->stats.minor_version = PROFILE_MINOR_VERSION;
444 pv->md.md_size = sizeof(struct profile_md);
445 pv->md.major_version = PROFILE_MAJOR_VERSION;
446 pv->md.minor_version = PROFILE_MINOR_VERSION;
447 pv->md.hash_size = _profile_hash_size;
448 pv->md.num_cache = MAX_CACHE;
449 pv->md.mcount_ptr_ptr = &_mcount_ptr;
450 pv->md.dummy_ptr = &_gprof_dummy;
451 pv->md.alloc_pages = _profile_alloc_pages;
455 pv->acontext[ac] = (struct alloc_context *)0;
468 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
469 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
503 ptr = _profile_md_acontext(pv, ptr, extra_arc_size, ACONTEXT_GPROF);
504 ptr = _profile_md_acontext(pv, ptr, extra_func_size, ACONTEXT_GFUNC);
506 ptr = _profile_md_acontext(pv, ptr, arc_size, ACONTEXT_GPROF);
507 ptr = _profile_md_acontext(pv, ptr, func_size, ACONTEXT_GFUNC);
508 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
509 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
512 pv->md.hash_ptr = (struct hasharc **) _profile_alloc(pv, hash_size, ACONTEXT_MISC);
524 ptr = _profile_md_acontext(pv, ptr, func_size, ACONTEXT_PROF);
525 ptr = _profile_md_acontext(pv, ptr, misc_size, ACONTEXT_MISC);
526 ptr = _profile_md_acontext(pv, ptr, callback_size, ACONTEXT_CALLBACK);
558 _profile_reset_alloc(struct profile_vars *pv, acontext_type_t ac)
563 for (aptr = pv->acontext[ac];
588 _profile_reset(struct profile_vars *pv)
594 if (pv->active) {
599 for (aptr = pv->acontext[ACONTEXT_GFUNC];
617 _profile_reset_alloc(pv, ACONTEXT_GPROF);
618 _profile_reset_alloc(pv, ACONTEXT_GFUNC);
619 _profile_reset_alloc(pv, ACONTEXT_PROF);
621 memset((void *)pv->profil_buf, '\0', pv->profil_info.profil_len);
622 memset((void *)pv->md.hash_ptr, '\0', pv->md.hash_size * sizeof(struct hasharc *));
623 memset((void *)&pv->stats, '\0', sizeof(pv->stats));
625 pv->stats.stats_size = sizeof(struct profile_stats);
626 pv->stats.major_version = PROFILE_MAJOR_VERSION;
627 pv->stats.minor_version = PROFILE_MINOR_VERSION;
629 if (pv->active) {
641 _gprof_write(struct profile_vars *pv, struct callback *callback_ptr)
649 for (aptr = pv->acontext[ACONTEXT_GPROF];
661 if (pv->check_funcs) {
662 if (arc.frompc < pv->profil_info.lowpc ||
663 arc.frompc > pv->profil_info.highpc) {
665 arc.frompc = (prof_uptrint_t)pv->bogus_func;
668 if (arc.selfpc < pv->profil_info.lowpc ||
669 arc.selfpc > pv->profil_info.highpc) {
671 arc.selfpc = (prof_uptrint_t)pv->bogus_func;
679 if ((*pv->fwrite_func)((void *)&arc,
682 pv->stream) != 1) {
684 _profile_error(pv);
703 _prof_write(struct profile_vars *pv, struct callback *callback_ptr)
715 for (aptr = pv->acontext[ACONTEXT_PROF];
731 if ((*pv->fwrite_func)((void *)&prof_st,
734 pv->stream) != 1) {
736 _profile_error(pv);
746 for (aptr = pv->acontext[ACONTEXT_GFUNC];
762 if ((*pv->fwrite_func)((void *)&prof_st,
765 pv->stream) != 1) {
767 _profile_error(pv);
787 _profile_update_stats(struct profile_vars *pv)
798 pv->stats.buckets[i] = 0;
801 pv->stats.hash_buckets = 0;
803 if (pv->md.hash_ptr) {
804 for (i = 0; i < pv->md.hash_size; i++) {
808 for (hptr = pv->md.hash_ptr[i]; hptr; hptr = hptr->next) {
812 pv->stats.buckets[ (nbuckets < MAX_BUCKETS) ? nbuckets : MAX_BUCKETS ]++;
813 if (pv->stats.hash_buckets < nbuckets) {
814 pv->stats.hash_buckets = nbuckets;
820 if (pv->check_funcs) {
821 pv->stats.bogus_count = 0;
823 for (aptr = pv->acontext[ACONTEXT_GPROF];
834 if (hptr->arc.frompc < pv->profil_info.lowpc ||
835 hptr->arc.frompc > pv->profil_info.highpc) {
836 pv->stats.bogus_count++;
839 if (hptr->arc.selfpc < pv->profil_info.lowpc ||
840 hptr->arc.selfpc > pv->profil_info.highpc) {
841 pv->stats.bogus_count++;
849 PROF_ULONG_TO_CNT(pv->stats.prof_overflow, 0);
850 PROF_ULONG_TO_CNT(pv->stats.gprof_overflow, 0);
852 for (aptr = pv->acontext[ACONTEXT_GPROF];
862 PROF_CNT_ADD(pv->stats.gprof_overflow, hptr->overflow);
867 for (aptr = pv->acontext[ACONTEXT_PROF];
877 PROF_CNT_ADD(pv->stats.prof_overflow, pptr->overflow);
882 for (aptr = pv->acontext[ACONTEXT_GFUNC];
892 PROF_CNT_ADD(pv->stats.prof_overflow, fptr->prof.overflow);
898 lptr = (LHISTCOUNTER *)pv->profil_buf;
900 if (pv->use_profil &&
901 pv->profil_info.counter_size == sizeof(LHISTCOUNTER) &&
904 PROF_ULONG_TO_CNT(pv->stats.overflow_ticks, 0);
905 for (i = 0; i < pv->stats.profil_buckets; i++) {
906 PROF_CNT_ADD(pv->stats.overflow_ticks, lptr[i].high);