Skip to content

Commit

Permalink
Report stats for tdatas_mtx and prof_dump_mtx
Browse files Browse the repository at this point in the history
  • Loading branch information
yinan1048576 committed Aug 9, 2019
1 parent 87e2400 commit 3934355
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
24 changes: 24 additions & 0 deletions doc/jemalloc.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -2509,6 +2509,30 @@ struct extent_hooks_s {
counters</link>.</para></listitem>
</varlistentry>

<varlistentry id="stats.mutexes.prof_tdatas">
<term>
<mallctl>stats.mutexes.prof_thds_data.{counter}</mallctl>
(<type>counter specific type</type>) <literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Statistics on <varname>prof</varname> threads data mutex
(global scope; profiling related). <mallctl>{counter}</mallctl> is one
of the counters in <link linkend="mutex_counters">mutex profiling
counters</link>.</para></listitem>
</varlistentry>

<varlistentry id="stats.mutexes.prof_dump">
<term>
<mallctl>stats.mutexes.prof_dump.{counter}</mallctl>
(<type>counter specific type</type>) <literal>r-</literal>
[<option>--enable-stats</option>]
</term>
<listitem><para>Statistics on <varname>prof</varname> dumping mutex
(global scope; profiling related). <mallctl>{counter}</mallctl> is one
of the counters in <link linkend="mutex_counters">mutex profiling
counters</link>.</para></listitem>
</varlistentry>

<varlistentry id="stats.mutexes.reset">
<term>
<mallctl>stats.mutexes.reset</mallctl>
Expand Down
4 changes: 3 additions & 1 deletion include/jemalloc/internal/mutex_prof.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
#define MUTEX_PROF_GLOBAL_MUTEXES \
OP(background_thread) \
OP(ctl) \
OP(prof)
OP(prof) \
OP(prof_thds_data) \
OP(prof_dump)

typedef enum {
#define OP(mtx) global_prof_mutex_##mtx,
Expand Down
10 changes: 8 additions & 2 deletions src/ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,12 @@ ctl_refresh(tsdn_t *tsdn) {
malloc_mutex_unlock(tsdn, &mtx);

if (config_prof && opt_prof) {
READ_GLOBAL_MUTEX_PROF_DATA(global_prof_mutex_prof,
bt2gctx_mtx);
READ_GLOBAL_MUTEX_PROF_DATA(
global_prof_mutex_prof, bt2gctx_mtx);
READ_GLOBAL_MUTEX_PROF_DATA(
global_prof_mutex_prof_thds_data, tdatas_mtx);
READ_GLOBAL_MUTEX_PROF_DATA(
global_prof_mutex_prof_dump, prof_dump_mtx);
}
if (have_background_thread) {
READ_GLOBAL_MUTEX_PROF_DATA(
Expand Down Expand Up @@ -2972,6 +2976,8 @@ stats_mutexes_reset_ctl(tsd_t *tsd, const size_t *mib,
}
if (config_prof && opt_prof) {
MUTEX_PROF_RESET(bt2gctx_mtx);
MUTEX_PROF_RESET(tdatas_mtx);
MUTEX_PROF_RESET(prof_dump_mtx);
}


Expand Down

0 comments on commit 3934355

Please sign in to comment.