mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
Rename Brofiler to ScriptCoverageManager
This commit is contained in:
parent
7fefdd97af
commit
3e6ba198db
5 changed files with 39 additions and 39 deletions
|
@ -219,7 +219,6 @@ set(MAIN_SRCS
|
||||||
Attr.cc
|
Attr.cc
|
||||||
Base64.cc
|
Base64.cc
|
||||||
BifReturnVal.cc
|
BifReturnVal.cc
|
||||||
Brofiler.cc
|
|
||||||
CCL.cc
|
CCL.cc
|
||||||
CompHash.cc
|
CompHash.cc
|
||||||
Conn.cc
|
Conn.cc
|
||||||
|
@ -273,6 +272,7 @@ set(MAIN_SRCS
|
||||||
RuleMatcher.cc
|
RuleMatcher.cc
|
||||||
SmithWaterman.cc
|
SmithWaterman.cc
|
||||||
Scope.cc
|
Scope.cc
|
||||||
|
ScriptCoverageManager.cc
|
||||||
SerializationFormat.cc
|
SerializationFormat.cc
|
||||||
Sessions.cc
|
Sessions.cc
|
||||||
Notifier.cc
|
Notifier.cc
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#include "Brofiler.h"
|
#include "ScriptCoverageManager.h"
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
@ -17,18 +17,18 @@ using namespace std;
|
||||||
|
|
||||||
namespace zeek::detail {
|
namespace zeek::detail {
|
||||||
|
|
||||||
Brofiler::Brofiler()
|
ScriptCoverageManager::ScriptCoverageManager()
|
||||||
: ignoring(0), delim('\t')
|
: ignoring(0), delim('\t')
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
Brofiler::~Brofiler()
|
ScriptCoverageManager::~ScriptCoverageManager()
|
||||||
{
|
{
|
||||||
for ( auto& s : stmts )
|
for ( auto& s : stmts )
|
||||||
Unref(s);
|
Unref(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Brofiler::AddStmt(zeek::detail::Stmt* s)
|
void ScriptCoverageManager::AddStmt(zeek::detail::Stmt* s)
|
||||||
{
|
{
|
||||||
if ( ignoring != 0 )
|
if ( ignoring != 0 )
|
||||||
return;
|
return;
|
||||||
|
@ -37,7 +37,7 @@ void Brofiler::AddStmt(zeek::detail::Stmt* s)
|
||||||
stmts.push_back(s);
|
stmts.push_back(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Brofiler::ReadStats()
|
bool ScriptCoverageManager::ReadStats()
|
||||||
{
|
{
|
||||||
char* bf = zeekenv("ZEEK_PROFILER_FILE");
|
char* bf = zeekenv("ZEEK_PROFILER_FILE");
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ bool Brofiler::ReadStats()
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Brofiler::WriteStats()
|
bool ScriptCoverageManager::WriteStats()
|
||||||
{
|
{
|
||||||
char* bf = zeekenv("ZEEK_PROFILER_FILE");
|
char* bf = zeekenv("ZEEK_PROFILER_FILE");
|
||||||
|
|
|
@ -13,10 +13,10 @@ namespace zeek::detail {
|
||||||
/**
|
/**
|
||||||
* A simple class for managing stats of Bro script coverage across Bro runs.
|
* A simple class for managing stats of Bro script coverage across Bro runs.
|
||||||
*/
|
*/
|
||||||
class Brofiler {
|
class ScriptCoverageManager {
|
||||||
public:
|
public:
|
||||||
Brofiler();
|
ScriptCoverageManager();
|
||||||
virtual ~Brofiler();
|
virtual ~ScriptCoverageManager();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Imports Bro script Stmt usage information from file pointed to by
|
* Imports Bro script Stmt usage information from file pointed to by
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
* The current, global Brofiler instance creates this list at parse-time.
|
* The current, global ScriptCoverageManager instance creates this list at parse-time.
|
||||||
*/
|
*/
|
||||||
std::list<zeek::detail::Stmt*> stmts;
|
std::list<zeek::detail::Stmt*> stmts;
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ private:
|
||||||
uint32_t ignoring;
|
uint32_t ignoring;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The character to use to delimit Brofiler output files. Default is '\t'.
|
* The character to use to delimit ScriptCoverageManager output files. Default is '\t'.
|
||||||
*/
|
*/
|
||||||
char delim;
|
char delim;
|
||||||
|
|
||||||
|
@ -71,7 +71,7 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A canonicalization routine for Stmt descriptions containing characters
|
* A canonicalization routine for Stmt descriptions containing characters
|
||||||
* that don't agree with the output format of Brofiler.
|
* that don't agree with the output format of ScriptCoverageManager.
|
||||||
*/
|
*/
|
||||||
struct canonicalize_desc {
|
struct canonicalize_desc {
|
||||||
char delim;
|
char delim;
|
||||||
|
@ -84,9 +84,9 @@ private:
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
extern Brofiler brofiler;
|
extern ScriptCoverageManager script_coverage_mgr;
|
||||||
|
|
||||||
} // namespace zeek::detail
|
} // namespace zeek::detail
|
||||||
|
|
||||||
using Brofiler [[deprecated("Remove in v4.1. Use zeek::detail::Brofiler.")]] = zeek::detail::Brofiler;
|
using Brofiler [[deprecated("Remove in v4.1. Use zeek::detail::ScriptCoverageManager.")]] = zeek::detail::ScriptCoverageManager;
|
||||||
extern zeek::detail::Brofiler& brofiler [[deprecated("Remove in v4.1. Use zeek::detail::brofiler.")]];
|
extern zeek::detail::ScriptCoverageManager& brofiler [[deprecated("Remove in v4.1. Use zeek::detail::brofiler.")]];
|
36
src/parse.y
36
src/parse.y
|
@ -90,7 +90,7 @@
|
||||||
#include "RE.h"
|
#include "RE.h"
|
||||||
#include "Scope.h"
|
#include "Scope.h"
|
||||||
#include "Reporter.h"
|
#include "Reporter.h"
|
||||||
#include "Brofiler.h"
|
#include "ScriptCoverageManager.h"
|
||||||
#include "zeekygen/Manager.h"
|
#include "zeekygen/Manager.h"
|
||||||
#include "module_util.h"
|
#include "module_util.h"
|
||||||
#include "IntrusivePtr.h"
|
#include "IntrusivePtr.h"
|
||||||
|
@ -1416,7 +1416,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @4);
|
zeek::detail::set_location(@1, @4);
|
||||||
$$ = $3;
|
$$ = $3;
|
||||||
if ( $2 )
|
if ( $2 )
|
||||||
zeek::detail::brofiler.DecIgnoreDepth();
|
zeek::detail::script_coverage_mgr.DecIgnoreDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_PRINT expr_list ';' opt_no_test
|
| TOK_PRINT expr_list ';' opt_no_test
|
||||||
|
@ -1424,7 +1424,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @3);
|
zeek::detail::set_location(@1, @3);
|
||||||
$$ = new zeek::detail::PrintStmt(zeek::IntrusivePtr{zeek::AdoptRef{}, $2});
|
$$ = new zeek::detail::PrintStmt(zeek::IntrusivePtr{zeek::AdoptRef{}, $2});
|
||||||
if ( ! $4 )
|
if ( ! $4 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_EVENT event ';' opt_no_test
|
| TOK_EVENT event ';' opt_no_test
|
||||||
|
@ -1432,7 +1432,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @3);
|
zeek::detail::set_location(@1, @3);
|
||||||
$$ = new zeek::detail::EventStmt({zeek::AdoptRef{}, $2});
|
$$ = new zeek::detail::EventStmt({zeek::AdoptRef{}, $2});
|
||||||
if ( ! $4 )
|
if ( ! $4 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_IF '(' expr ')' stmt
|
| TOK_IF '(' expr ')' stmt
|
||||||
|
@ -1468,7 +1468,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::NextStmt;
|
$$ = new zeek::detail::NextStmt;
|
||||||
if ( ! $3 )
|
if ( ! $3 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_BREAK ';' opt_no_test
|
| TOK_BREAK ';' opt_no_test
|
||||||
|
@ -1476,7 +1476,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::BreakStmt;
|
$$ = new zeek::detail::BreakStmt;
|
||||||
if ( ! $3 )
|
if ( ! $3 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_FALLTHROUGH ';' opt_no_test
|
| TOK_FALLTHROUGH ';' opt_no_test
|
||||||
|
@ -1484,7 +1484,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::FallthroughStmt;
|
$$ = new zeek::detail::FallthroughStmt;
|
||||||
if ( ! $3 )
|
if ( ! $3 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_RETURN ';' opt_no_test
|
| TOK_RETURN ';' opt_no_test
|
||||||
|
@ -1492,7 +1492,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::ReturnStmt(0);
|
$$ = new zeek::detail::ReturnStmt(0);
|
||||||
if ( ! $3 )
|
if ( ! $3 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_RETURN expr ';' opt_no_test
|
| TOK_RETURN expr ';' opt_no_test
|
||||||
|
@ -1500,7 +1500,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::ReturnStmt({zeek::AdoptRef{}, $2});
|
$$ = new zeek::detail::ReturnStmt({zeek::AdoptRef{}, $2});
|
||||||
if ( ! $4 )
|
if ( ! $4 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_ADD expr ';' opt_no_test
|
| TOK_ADD expr ';' opt_no_test
|
||||||
|
@ -1508,7 +1508,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @3);
|
zeek::detail::set_location(@1, @3);
|
||||||
$$ = new zeek::detail::AddStmt({zeek::AdoptRef{}, $2});
|
$$ = new zeek::detail::AddStmt({zeek::AdoptRef{}, $2});
|
||||||
if ( ! $4 )
|
if ( ! $4 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_DELETE expr ';' opt_no_test
|
| TOK_DELETE expr ';' opt_no_test
|
||||||
|
@ -1516,7 +1516,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @3);
|
zeek::detail::set_location(@1, @3);
|
||||||
$$ = new zeek::detail::DelStmt({zeek::AdoptRef{}, $2});
|
$$ = new zeek::detail::DelStmt({zeek::AdoptRef{}, $2});
|
||||||
if ( ! $4 )
|
if ( ! $4 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_LOCAL local_id opt_type init_class opt_init opt_attr ';' opt_no_test
|
| TOK_LOCAL local_id opt_type init_class opt_init opt_attr ';' opt_no_test
|
||||||
|
@ -1527,7 +1527,7 @@ stmt:
|
||||||
std::unique_ptr<std::vector<zeek::detail::AttrPtr>>{$6},
|
std::unique_ptr<std::vector<zeek::detail::AttrPtr>>{$6},
|
||||||
VAR_REGULAR).release();
|
VAR_REGULAR).release();
|
||||||
if ( ! $8 )
|
if ( ! $8 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_CONST local_id opt_type init_class opt_init opt_attr ';' opt_no_test
|
| TOK_CONST local_id opt_type init_class opt_init opt_attr ';' opt_no_test
|
||||||
|
@ -1538,7 +1538,7 @@ stmt:
|
||||||
std::unique_ptr<std::vector<zeek::detail::AttrPtr>>{$6},
|
std::unique_ptr<std::vector<zeek::detail::AttrPtr>>{$6},
|
||||||
VAR_CONST).release();
|
VAR_CONST).release();
|
||||||
if ( ! $8 )
|
if ( ! $8 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| TOK_WHEN '(' expr ')' stmt
|
| TOK_WHEN '(' expr ')' stmt
|
||||||
|
@ -1554,7 +1554,7 @@ stmt:
|
||||||
$$ = new zeek::detail::WhenStmt({zeek::AdoptRef{}, $3}, {zeek::AdoptRef{}, $5},
|
$$ = new zeek::detail::WhenStmt({zeek::AdoptRef{}, $3}, {zeek::AdoptRef{}, $5},
|
||||||
{zeek::AdoptRef{}, $10}, {zeek::AdoptRef{}, $7}, false);
|
{zeek::AdoptRef{}, $10}, {zeek::AdoptRef{}, $7}, false);
|
||||||
if ( $9 )
|
if ( $9 )
|
||||||
zeek::detail::brofiler.DecIgnoreDepth();
|
zeek::detail::script_coverage_mgr.DecIgnoreDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1571,7 +1571,7 @@ stmt:
|
||||||
$$ = new zeek::detail::WhenStmt({zeek::AdoptRef{}, $4}, {zeek::AdoptRef{}, $6},
|
$$ = new zeek::detail::WhenStmt({zeek::AdoptRef{}, $4}, {zeek::AdoptRef{}, $6},
|
||||||
{zeek::AdoptRef{}, $11}, {zeek::AdoptRef{}, $8}, true);
|
{zeek::AdoptRef{}, $11}, {zeek::AdoptRef{}, $8}, true);
|
||||||
if ( $10 )
|
if ( $10 )
|
||||||
zeek::detail::brofiler.DecIgnoreDepth();
|
zeek::detail::script_coverage_mgr.DecIgnoreDepth();
|
||||||
}
|
}
|
||||||
|
|
||||||
| index_slice '=' expr ';' opt_no_test
|
| index_slice '=' expr ';' opt_no_test
|
||||||
|
@ -1581,7 +1581,7 @@ stmt:
|
||||||
{zeek::AdoptRef{}, $3}, in_init));
|
{zeek::AdoptRef{}, $3}, in_init));
|
||||||
|
|
||||||
if ( ! $5 )
|
if ( ! $5 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| expr ';' opt_no_test
|
| expr ';' opt_no_test
|
||||||
|
@ -1589,7 +1589,7 @@ stmt:
|
||||||
zeek::detail::set_location(@1, @2);
|
zeek::detail::set_location(@1, @2);
|
||||||
$$ = new zeek::detail::ExprStmt({zeek::AdoptRef{}, $1});
|
$$ = new zeek::detail::ExprStmt({zeek::AdoptRef{}, $1});
|
||||||
if ( ! $3 )
|
if ( ! $3 )
|
||||||
zeek::detail::brofiler.AddStmt($$);
|
zeek::detail::script_coverage_mgr.AddStmt($$);
|
||||||
}
|
}
|
||||||
|
|
||||||
| ';'
|
| ';'
|
||||||
|
@ -1881,7 +1881,7 @@ opt_no_test:
|
||||||
|
|
||||||
opt_no_test_block:
|
opt_no_test_block:
|
||||||
TOK_NO_TEST
|
TOK_NO_TEST
|
||||||
{ $$ = true; zeek::detail::brofiler.IncIgnoreDepth(); }
|
{ $$ = true; zeek::detail::script_coverage_mgr.IncIgnoreDepth(); }
|
||||||
|
|
|
|
||||||
{ $$ = false; }
|
{ $$ = false; }
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ extern "C" {
|
||||||
#include "Anon.h"
|
#include "Anon.h"
|
||||||
#include "EventRegistry.h"
|
#include "EventRegistry.h"
|
||||||
#include "Stats.h"
|
#include "Stats.h"
|
||||||
#include "Brofiler.h"
|
#include "ScriptCoverageManager.h"
|
||||||
#include "Traverse.h"
|
#include "Traverse.h"
|
||||||
#include "Trigger.h"
|
#include "Trigger.h"
|
||||||
#include "Hash.h"
|
#include "Hash.h"
|
||||||
|
@ -67,8 +67,8 @@ extern "C" {
|
||||||
#define DOCTEST_CONFIG_IMPLEMENT
|
#define DOCTEST_CONFIG_IMPLEMENT
|
||||||
#include "3rdparty/doctest.h"
|
#include "3rdparty/doctest.h"
|
||||||
|
|
||||||
zeek::detail::Brofiler zeek::detail::brofiler;
|
zeek::detail::ScriptCoverageManager zeek::detail::script_coverage_mgr;
|
||||||
zeek::detail::Brofiler& brofiler = zeek::detail::brofiler;
|
zeek::detail::ScriptCoverageManager& brofiler = zeek::detail::script_coverage_mgr;
|
||||||
|
|
||||||
#ifndef HAVE_STRSEP
|
#ifndef HAVE_STRSEP
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -282,7 +282,7 @@ void terminate_bro()
|
||||||
// the termination process.
|
// the termination process.
|
||||||
file_mgr->Terminate();
|
file_mgr->Terminate();
|
||||||
|
|
||||||
zeek::detail::brofiler.WriteStats();
|
zeek::detail::script_coverage_mgr.WriteStats();
|
||||||
|
|
||||||
if ( zeek_done )
|
if ( zeek_done )
|
||||||
zeek::event_mgr.Enqueue(zeek_done, zeek::Args{});
|
zeek::event_mgr.Enqueue(zeek_done, zeek::Args{});
|
||||||
|
@ -434,7 +434,7 @@ zeek::detail::SetupResult zeek::detail::setup(int argc, char** argv,
|
||||||
if ( zeek::Supervisor::ThisNode() )
|
if ( zeek::Supervisor::ThisNode() )
|
||||||
zeek::Supervisor::ThisNode()->Init(&options);
|
zeek::Supervisor::ThisNode()->Init(&options);
|
||||||
|
|
||||||
zeek::detail::brofiler.ReadStats();
|
zeek::detail::script_coverage_mgr.ReadStats();
|
||||||
|
|
||||||
auto dns_type = options.dns_mode;
|
auto dns_type = options.dns_mode;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue