Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show line info + module in ADD_METHOD profiling #49495

Merged
merged 2 commits into from
Apr 27, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/gf.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ JL_DLLEXPORT void jl_method_table_insert(jl_methtable_t *mt, jl_method_t *method
JL_TIMING(ADD_METHOD, ADD_METHOD);
assert(jl_is_method(method));
assert(jl_is_mtable(mt));
jl_timing_show((jl_value_t *)method, JL_TIMING_CURRENT_BLOCK);
jl_timing_show_method(method, JL_TIMING_CURRENT_BLOCK);
jl_value_t *type = method->sig;
jl_value_t *oldvalue = NULL;
jl_array_t *oldmi = NULL;
Expand Down
11 changes: 10 additions & 1 deletion src/timing.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ jl_timing_block_t *jl_timing_block_exit_task(jl_task_t *ct, jl_ptls_t ptls)

static inline const char *gnu_basename(const char *path)
{
char *base = strrchr(path, '/');
const char *base = strrchr(path, '/');
return base ? base+1 : path;
}

Expand Down Expand Up @@ -188,6 +188,15 @@ JL_DLLEXPORT void jl_timing_show_method_instance(jl_method_instance_t *mi, jl_ti
jl_symbol_name(def->module->name));
}

JL_DLLEXPORT void jl_timing_show_method(jl_method_t *method, jl_timing_block_t *cur_block)
{
jl_timing_show((jl_value_t *)method, cur_block);
topolarity marked this conversation as resolved.
Show resolved Hide resolved
jl_timing_printf(cur_block, "%s:%d in %s",
gnu_basename(jl_symbol_name(method->file)),
method->line,
jl_symbol_name(method->module->name));
}

JL_DLLEXPORT void jl_timing_show_func_sig(jl_value_t *v, jl_timing_block_t *cur_block)
{
#ifdef USE_TRACY
Expand Down
2 changes: 2 additions & 0 deletions src/timing.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ extern uint32_t jl_timing_print_limit;
#define jl_timing_show_module(m, b)
#define jl_timing_show_filename(f, b)
#define jl_timing_show_method_instance(mi, b)
#define jl_timing_show_method(mi, b)
#define jl_timing_show_func_sig(tt, b)
#define jl_timing_printf(s, f, ...)
#define jl_timing_block_enter_task(ct, ptls, blk)
Expand Down Expand Up @@ -96,6 +97,7 @@ void jl_timing_show(jl_value_t *v, jl_timing_block_t *cur_block);
void jl_timing_show_module(jl_module_t *m, jl_timing_block_t *cur_block);
void jl_timing_show_filename(const char *path, jl_timing_block_t *cur_block);
void jl_timing_show_method_instance(jl_method_instance_t *mi, jl_timing_block_t *cur_block);
void jl_timing_show_method(jl_method_t *method, jl_timing_block_t *cur_block);
void jl_timing_show_func_sig(jl_value_t *v, jl_timing_block_t *cur_block);
void jl_timing_printf(jl_timing_block_t *cur_block, const char *format, ...);
#ifdef __cplusplus
Expand Down