Lines Matching refs:fp
483 ufunc_T *fp; in prof_sort_list() local
489 fp = sorttab[i]; in prof_sort_list()
490 prof_func_line(fd, fp->uf_tm_count, &fp->uf_tm_total, &fp->uf_tm_self, in prof_sort_list()
492 if (fp->uf_name[0] == K_SPECIAL) in prof_sort_list()
493 fprintf(fd, " <SNR>%s()\n", fp->uf_name + 3); in prof_sort_list()
495 fprintf(fd, " %s()\n", fp->uf_name); in prof_sort_list()
530 func_do_profile(ufunc_T *fp) in func_do_profile() argument
532 int len = fp->uf_lines.ga_len; in func_do_profile()
534 if (!fp->uf_prof_initialized) in func_do_profile()
538 fp->uf_tm_count = 0; in func_do_profile()
539 profile_zero(&fp->uf_tm_self); in func_do_profile()
540 profile_zero(&fp->uf_tm_total); in func_do_profile()
541 if (fp->uf_tml_count == NULL) in func_do_profile()
542 fp->uf_tml_count = ALLOC_CLEAR_MULT(int, len); in func_do_profile()
543 if (fp->uf_tml_total == NULL) in func_do_profile()
544 fp->uf_tml_total = ALLOC_CLEAR_MULT(proftime_T, len); in func_do_profile()
545 if (fp->uf_tml_self == NULL) in func_do_profile()
546 fp->uf_tml_self = ALLOC_CLEAR_MULT(proftime_T, len); in func_do_profile()
547 fp->uf_tml_idx = -1; in func_do_profile()
548 if (fp->uf_tml_count == NULL || fp->uf_tml_total == NULL in func_do_profile()
549 || fp->uf_tml_self == NULL) in func_do_profile()
551 fp->uf_prof_initialized = TRUE; in func_do_profile()
554 fp->uf_profiling = TRUE; in func_do_profile()
579 profile_may_start_func(profinfo_T *info, ufunc_T *fp, ufunc_T *caller) in profile_may_start_func() argument
581 if (!fp->uf_profiling && has_profiling(FALSE, fp->uf_name, NULL)) in profile_may_start_func()
584 func_do_profile(fp); in profile_may_start_func()
586 if (fp->uf_profiling || (caller != NULL && caller->uf_profiling)) in profile_may_start_func()
588 ++fp->uf_tm_count; in profile_may_start_func()
590 profile_zero(&fp->uf_tm_children); in profile_may_start_func()
600 profile_may_end_func(profinfo_T *info, ufunc_T *fp, ufunc_T *caller) in profile_may_end_func() argument
604 profile_add(&fp->uf_tm_total, &info->pi_call_start); in profile_may_end_func()
605 profile_self(&fp->uf_tm_self, &info->pi_call_start, &fp->uf_tm_children); in profile_may_end_func()
613 fp->uf_profiling = FALSE; in profile_may_end_func()
662 ufunc_T *fp = fcp->func; in func_line_start() local
664 if (fp->uf_profiling && lnum >= 1 && lnum <= fp->uf_lines.ga_len) in func_line_start()
666 fp->uf_tml_idx = lnum - 1; in func_line_start()
668 while (fp->uf_tml_idx > 0 && FUNCLINE(fp, fp->uf_tml_idx) == NULL) in func_line_start()
669 --fp->uf_tml_idx; in func_line_start()
670 fp->uf_tml_execed = FALSE; in func_line_start()
671 profile_start(&fp->uf_tml_start); in func_line_start()
672 profile_zero(&fp->uf_tml_children); in func_line_start()
673 profile_get_wait(&fp->uf_tml_wait); in func_line_start()
684 ufunc_T *fp = fcp->func; in func_line_exec() local
686 if (fp->uf_profiling && fp->uf_tml_idx >= 0) in func_line_exec()
687 fp->uf_tml_execed = TRUE; in func_line_exec()
697 ufunc_T *fp = fcp->func; in func_line_end() local
699 if (fp->uf_profiling && fp->uf_tml_idx >= 0) in func_line_end()
701 if (fp->uf_tml_execed) in func_line_end()
703 ++fp->uf_tml_count[fp->uf_tml_idx]; in func_line_end()
704 profile_end(&fp->uf_tml_start); in func_line_end()
705 profile_sub_wait(&fp->uf_tml_wait, &fp->uf_tml_start); in func_line_end()
706 profile_add(&fp->uf_tml_total[fp->uf_tml_idx], &fp->uf_tml_start); in func_line_end()
707 profile_self(&fp->uf_tml_self[fp->uf_tml_idx], &fp->uf_tml_start, in func_line_end()
708 &fp->uf_tml_children); in func_line_end()
710 fp->uf_tml_idx = -1; in func_line_end()
723 ufunc_T *fp; in func_dump_profile() local
741 fp = HI2UF(hi); in func_dump_profile()
742 if (fp->uf_prof_initialized) in func_dump_profile()
745 sorttab[st_len++] = fp; in func_dump_profile()
747 if (fp->uf_name[0] == K_SPECIAL) in func_dump_profile()
748 fprintf(fd, "FUNCTION <SNR>%s()\n", fp->uf_name + 3); in func_dump_profile()
750 fprintf(fd, "FUNCTION %s()\n", fp->uf_name); in func_dump_profile()
751 if (fp->uf_script_ctx.sc_sid > 0) in func_dump_profile()
754 get_scriptname(fp->uf_script_ctx.sc_sid)); in func_dump_profile()
758 p, (long)fp->uf_script_ctx.sc_lnum); in func_dump_profile()
762 if (fp->uf_tm_count == 1) in func_dump_profile()
765 fprintf(fd, "Called %d times\n", fp->uf_tm_count); in func_dump_profile()
766 fprintf(fd, "Total time: %s\n", profile_msg(&fp->uf_tm_total)); in func_dump_profile()
767 fprintf(fd, " Self time: %s\n", profile_msg(&fp->uf_tm_self)); in func_dump_profile()
771 for (i = 0; i < fp->uf_lines.ga_len; ++i) in func_dump_profile()
773 if (FUNCLINE(fp, i) == NULL) in func_dump_profile()
775 prof_func_line(fd, fp->uf_tml_count[i], in func_dump_profile()
776 &fp->uf_tml_total[i], &fp->uf_tml_self[i], TRUE); in func_dump_profile()
777 fprintf(fd, "%s\n", FUNCLINE(fp, i)); in func_dump_profile()