From 2aae90d4f2ae0b6f5f08d3732ff8915b1cf4ac56 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Mon, 6 Apr 2015 15:46:08 -0500 Subject: [PATCH] Remove stale signature benchmarking code (-L command-line option). I don't think this is seeing much use or will ever see much use, and unless compilers optimize it out, it's just wasting cycles. --- src/RE.cc | 6 ------ src/RuleMatcher.cc | 21 --------------------- src/RuleMatcher.h | 2 -- src/main.cc | 7 ------- 4 files changed, 36 deletions(-) diff --git a/src/RE.cc b/src/RE.cc index 4855b0e39a..f52eff47eb 100644 --- a/src/RE.cc +++ b/src/RE.cc @@ -20,9 +20,6 @@ int case_insensitive = 0; extern int RE_parse(void); extern void RE_set_input(const char* str); -// If true, the set-wise matching always returns false - for benchmarking. -extern int rule_bench; - Specific_RE_Matcher::Specific_RE_Matcher(match_type arg_mt, int arg_multiline) : equiv_class(NUM_SYM) { @@ -279,9 +276,6 @@ inline void RE_Match_State::AddMatches(const AcceptingSet& as, bool RE_Match_State::Match(const u_char* bv, int n, bool bol, bool eol, bool clear) { - if ( rule_bench > 0 ) - return false; - if ( current_pos == -1 ) { // First call to Match(). diff --git a/src/RuleMatcher.cc b/src/RuleMatcher.cc index 7b86ecbe45..9049846ae3 100644 --- a/src/RuleMatcher.cc +++ b/src/RuleMatcher.cc @@ -577,9 +577,6 @@ RuleFileMagicState* RuleMatcher::InitFileMagic() const { RuleFileMagicState* state = new RuleFileMagicState(); - if ( rule_bench == 3 ) - return state; - loop_over_list(root->psets[Rule::FILE_MAGIC], i) { RuleHdrTest::PatternSet* set = root->psets[Rule::FILE_MAGIC][i]; @@ -630,9 +627,6 @@ RuleMatcher::MIME_Matches* RuleMatcher::Match(RuleFileMagicState* state, return rval; } - if ( rule_bench >= 2 ) - return rval; - #ifdef DEBUG if ( debug_logger.IsEnabled(DBG_RULES) ) { @@ -712,9 +706,6 @@ RuleEndpointState* RuleMatcher::InitEndpoint(analyzer::Analyzer* analyzer, RuleEndpointState* state = new RuleEndpointState(analyzer, from_orig, opposite, pia); - if ( rule_bench == 3 ) - return state; - rule_hdr_test_list tests; tests.append(root); @@ -837,9 +828,6 @@ void RuleMatcher::Match(RuleEndpointState* state, Rule::PatternType type, // for 'accepted' (that depends on the average number of matching // patterns). - if ( rule_bench >= 2 ) - return; - bool newmatch = false; #ifdef DEBUG @@ -956,9 +944,6 @@ void RuleMatcher::Match(RuleEndpointState* state, Rule::PatternType type, void RuleMatcher::FinishEndpoint(RuleEndpointState* state) { - if ( rule_bench == 3 ) - return; - // Send EOL to payload matchers. Match(state, Rule::PAYLOAD, (const u_char *) "", 0, false, true, false); @@ -1110,9 +1095,6 @@ void RuleMatcher::ExecRule(Rule* rule, RuleEndpointState* state, bool eos) void RuleMatcher::ClearEndpointState(RuleEndpointState* state) { - if ( rule_bench == 3 ) - return; - state->payload_size = -1; loop_over_list(state->matchers, j) @@ -1121,9 +1103,6 @@ void RuleMatcher::ClearEndpointState(RuleEndpointState* state) void RuleMatcher::ClearFileMagicState(RuleFileMagicState* state) const { - if ( rule_bench == 3 ) - return; - loop_over_list(state->matchers, j) state->matchers[j]->state->Clear(); } diff --git a/src/RuleMatcher.h b/src/RuleMatcher.h index da2838cb6d..6ffc971db1 100644 --- a/src/RuleMatcher.h +++ b/src/RuleMatcher.h @@ -22,8 +22,6 @@ //#define MATCHER_PRINT_STATS -extern int rule_bench; - // Parser interface: extern void rules_error(const char* msg); diff --git a/src/main.cc b/src/main.cc index 24c19c19d9..d7259a7246 100644 --- a/src/main.cc +++ b/src/main.cc @@ -117,7 +117,6 @@ SampleLogger* sample_logger = 0; int signal_val = 0; int optimize = 0; int do_notice_analysis = 0; -int rule_bench = 0; extern char version[]; char* command_line_policy = 0; vector params; @@ -195,7 +194,6 @@ void usage() fprintf(stderr, " -F|--force-dns | force DNS\n"); fprintf(stderr, " -I|--print-id | print out given ID\n"); fprintf(stderr, " -K|--md5-hashkey | set key for MD5-keyed hashing\n"); - fprintf(stderr, " -L|--rule-benchmark | benchmark for rules\n"); fprintf(stderr, " -N|--print-plugins | print available plugins and exit (-NN for verbose)\n"); fprintf(stderr, " -O|--optimize | optimize policy script\n"); fprintf(stderr, " -P|--prime-dns | prime DNS\n"); @@ -503,7 +501,6 @@ int main(int argc, char** argv) {"save-seeds", required_argument, 0, 'H'}, {"set-seed", required_argument, 0, 'J'}, {"md5-hashkey", required_argument, 0, 'K'}, - {"rule-benchmark", no_argument, 0, 'L'}, {"print-plugins", no_argument, 0, 'N'}, {"optimize", no_argument, 0, 'O'}, {"prime-dns", no_argument, 0, 'P'}, @@ -668,10 +665,6 @@ int main(int argc, char** argv) hmac_key_set = 1; break; - case 'L': - ++rule_bench; - break; - case 'N': ++print_plugins; break;