mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 22:58:20 +00:00
fixes for ZAM profiling, which didn't get fully integrated originally
This commit is contained in:
parent
94e71b738a
commit
16e9af137f
4 changed files with 27 additions and 2 deletions
|
@ -193,7 +193,8 @@ static void print_analysis_help()
|
|||
fprintf(stderr, " no-ZAM-opt omit low-level ZAM optimization\n");
|
||||
fprintf(stderr, " optimize-all optimize all scripts, even inlined ones\n");
|
||||
fprintf(stderr, " optimize-AST optimize the (transformed) AST; implies xform\n");
|
||||
fprintf(stderr, " profile-ZAM generate to stdout a ZAM execution profile\n");
|
||||
fprintf(stderr,
|
||||
" profile-ZAM generate to stdout a ZAM execution profile; implies -O ZAM\n");
|
||||
fprintf(stderr, " report-recursive report on recursive functions and exit\n");
|
||||
fprintf(stderr, " xform transform scripts to \"reduced\" form\n");
|
||||
|
||||
|
@ -248,7 +249,7 @@ static void set_analysis_option(const char* opt, Options& opts)
|
|||
else if ( util::streq(opt, "optimize-AST") )
|
||||
a_o.activate = a_o.optimize_AST = true;
|
||||
else if ( util::streq(opt, "profile-ZAM") )
|
||||
a_o.activate = a_o.profile_ZAM = true;
|
||||
a_o.activate = a_o.gen_ZAM_code = a_o.profile_ZAM = true;
|
||||
else if ( util::streq(opt, "report-C++") )
|
||||
a_o.report_CPP = true;
|
||||
else if ( util::streq(opt, "report-recursive") )
|
||||
|
|
|
@ -578,4 +578,23 @@ void analyze_scripts()
|
|||
analyze_scripts_for_ZAM(pfs);
|
||||
}
|
||||
|
||||
void profile_script_execution()
|
||||
{
|
||||
if ( analysis_options.profile_ZAM )
|
||||
{
|
||||
report_ZOP_profile();
|
||||
|
||||
for ( auto& f : funcs )
|
||||
{
|
||||
if ( f.Body()->Tag() == STMT_ZAM )
|
||||
cast_intrusive<ZBody>(f.Body())->ProfileExecution();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void finish_script_execution()
|
||||
{
|
||||
profile_script_execution();
|
||||
}
|
||||
|
||||
} // namespace zeek::detail
|
||||
|
|
|
@ -185,6 +185,9 @@ extern bool should_analyze(const ScriptFuncPtr& f, const StmtPtr& body);
|
|||
// Analyze all of the parsed scripts collectively for optimization.
|
||||
extern void analyze_scripts();
|
||||
|
||||
// Called when Zeek is terminating.
|
||||
extern void finish_script_execution();
|
||||
|
||||
// Used for C++-compiled scripts to signal their presence, by setting this
|
||||
// to a non-empty value.
|
||||
extern void (*CPP_init_hook)();
|
||||
|
|
|
@ -324,6 +324,8 @@ static void terminate_bro()
|
|||
|
||||
plugin_mgr->FinishPlugins();
|
||||
|
||||
finish_script_execution();
|
||||
|
||||
delete zeekygen_mgr;
|
||||
delete packet_mgr;
|
||||
delete analyzer_mgr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue