Add simple profiling class to accumulate Stmt usage stats across runs.

Use the BROFILER_FILE environment variable to point to a file in
which Stmt usage statistics from Bro script-layer can be output.

This should be able to be used to check Bro script coverage that
that e.g. the entire test suite covers.
This commit is contained in:
Jon Siwek 2011-11-27 15:57:18 -06:00
parent c8839da069
commit 8f8290c852
8 changed files with 181 additions and 1 deletions

View file

@ -47,9 +47,12 @@ extern "C" void OPENSSL_add_all_algorithms_conf(void);
#include "ConnCompressor.h"
#include "DPM.h"
#include "BroDoc.h"
#include "Brofiler.h"
#include "binpac_bro.h"
Brofiler brofiler;
#ifndef HAVE_STRSEP
extern "C" {
char* strsep(char**, const char*);
@ -260,6 +263,8 @@ void terminate_bro()
terminating = true;
brofiler.WriteStats();
EventHandlerPtr bro_done = internal_handler("bro_done");
if ( bro_done )
mgr.QueueEvent(bro_done, new val_list);
@ -335,6 +340,7 @@ static void bro_new_handler()
int main(int argc, char** argv)
{
brofiler.ReadStats();
bro_argc = argc;
bro_argv = new char* [argc];