Refactor profiling
Refactored core profiling codebase into two logical parts: (a) `prof_data.c`: core internal data structure managing & dumping; (b) `prof.c`: mutexes & outward-facing APIs. Some internal functions had to be exposed out, but there are not that many of them if the modularization is (hopefully) clean enough.
This commit is contained in:
parent
7618b0b8e4
commit
0b462407ae
@ -117,6 +117,7 @@ C_SRCS := $(srcroot)src/jemalloc.c \
|
||||
$(srcroot)src/pages.c \
|
||||
$(srcroot)src/prng.c \
|
||||
$(srcroot)src/prof.c \
|
||||
$(srcroot)src/prof_data.c \
|
||||
$(srcroot)src/prof_log.c \
|
||||
$(srcroot)src/rtree.c \
|
||||
$(srcroot)src/safety_check.c \
|
||||
|
@ -4,6 +4,11 @@
|
||||
#include "jemalloc/internal/mutex.h"
|
||||
|
||||
extern malloc_mutex_t bt2gctx_mtx;
|
||||
extern malloc_mutex_t tdatas_mtx;
|
||||
extern malloc_mutex_t prof_dump_mtx;
|
||||
|
||||
malloc_mutex_t *prof_gctx_mutex_choose(void);
|
||||
malloc_mutex_t *prof_tdata_mutex_choose(uint64_t thr_uid);
|
||||
|
||||
extern bool opt_prof;
|
||||
extern bool opt_prof_active;
|
||||
@ -110,4 +115,13 @@ bool prof_log_rep_check(void);
|
||||
void prof_log_dummy_set(bool new_value);
|
||||
#endif
|
||||
|
||||
/* Functions in prof_data.c only accessed in prof.c */
|
||||
bool prof_data_init(tsd_t *tsd);
|
||||
bool prof_dump(tsd_t *tsd, bool propagate_err, const char *filename,
|
||||
bool leakcheck);
|
||||
prof_tdata_t * prof_tdata_init_impl(tsd_t *tsd, uint64_t thr_uid,
|
||||
uint64_t thr_discrim, char *thread_name, bool active);
|
||||
void prof_tdata_detach(tsd_t *tsd, prof_tdata_t *tdata);
|
||||
void prof_tctx_destroy(tsd_t *tsd, prof_tctx_t *tctx);
|
||||
|
||||
#endif /* JEMALLOC_INTERNAL_PROF_EXTERNS_H */
|
||||
|
@ -58,6 +58,7 @@
|
||||
<ClCompile Include="..\..\..\..\src\pages.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prng.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof_data.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof_log.c" />
|
||||
<ClCompile Include="..\..\..\..\src\rtree.c" />
|
||||
<ClCompile Include="..\..\..\..\src\sc.c" />
|
||||
|
@ -67,6 +67,9 @@
|
||||
<ClCompile Include="..\..\..\..\src\prof.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\src\prof_data.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\src\prof_log.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -58,6 +58,7 @@
|
||||
<ClCompile Include="..\..\..\..\src\pages.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prng.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof_data.c" />
|
||||
<ClCompile Include="..\..\..\..\src\prof_log.c" />
|
||||
<ClCompile Include="..\..\..\..\src\rtree.c" />
|
||||
<ClCompile Include="..\..\..\..\src\sc.c" />
|
||||
|
@ -67,6 +67,9 @@
|
||||
<ClCompile Include="..\..\..\..\src\prof.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\src\prof_data.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\..\src\prof_log.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
1492
src/prof.c
1492
src/prof.c
File diff suppressed because it is too large
Load Diff
1440
src/prof_data.c
Normal file
1440
src/prof_data.c
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user