new ZEEK_FILE_ONLY and ZEEK_FUNC_ONLY environment variables for debugging script optimization - replaces ZEEK_ONLY

This commit is contained in:
Vern Paxson 2021-12-12 12:34:50 -08:00
parent 96ed944571
commit d5e7db1070

View file

@ -99,16 +99,16 @@ bool should_analyze(const ScriptFuncPtr& f, const StmtPtr& body)
if ( ofiles.empty() && ofuncs.empty() )
return true;
auto fn = f->Name();
auto fun = f->Name();
for ( auto& o : ofuncs )
if ( std::regex_match(fn, o) )
if ( std::regex_match(fun, o) )
return true;
fn = body->GetLocationInfo()->filename;
auto fin = util::detail::normalize_path(body->GetLocationInfo()->filename);
for ( auto& o : ofiles )
if ( std::regex_match(fn, o) )
if ( std::regex_match(fin, o) )
return true;
return false;
@ -296,7 +296,14 @@ static void init_options()
if ( analysis_options.only_funcs.empty() )
{
auto zo = getenv("ZEEK_ONLY");
auto zo = getenv("ZEEK_FUNC_ONLY");
if ( zo )
add_func_analysis_pattern(analysis_options, zo);
}
if ( analysis_options.only_files.empty() )
{
auto zo = getenv("ZEEK_FILE_ONLY");
if ( zo )
add_file_analysis_pattern(analysis_options, zo);
}