From: Brian Demsky Date: Mon, 6 May 2013 23:28:44 +0000 (-0700) Subject: print some stats in SC Analysis X-Git-Tag: oopsla2013~14 X-Git-Url: http://plrg.eecs.uci.edu/git/?p=model-checker.git;a=commitdiff_plain;h=438f5696e36189161ab3fc9ed2e6c854a723bb6e print some stats in SC Analysis --- diff --git a/scanalysis.cc b/scanalysis.cc index 96dec70..1776387 100644 --- a/scanalysis.cc +++ b/scanalysis.cc @@ -15,6 +15,7 @@ SCAnalysis::SCAnalysis() : execution(NULL), print_always(false), print_buggy(true), + print_nonsc(false), time(false), stats((struct sc_statistics *)model_calloc(1, sizeof(struct sc_statistics))) { @@ -36,6 +37,8 @@ const char * SCAnalysis::name() { void SCAnalysis::finish() { if (time) model_print("Elapsed time in usec %llu\n", stats->elapsedtime); + model_print("SC count: %u\n", stats->sccount); + model_print("Non-SC count: %u\n", stats->nonsccount); } bool SCAnalysis::option(char * opt) { @@ -47,6 +50,9 @@ bool SCAnalysis::option(char * opt) { } else if (strcmp(opt, "quiet")==0) { print_buggy=false; return false; + } else if (strcmp(opt, "nonsc")==0) { + print_nonsc=true; + return false; } else if (strcmp(opt, "time")==0) { time=true; return false; @@ -57,6 +63,7 @@ bool SCAnalysis::option(char * opt) { model_print("SC Analysis options\n"); model_print("verbose -- print all feasible executions\n"); model_print("buggy -- print only buggy executions (default)\n"); + model_print("nonsc -- print non-sc execution\n"); model_print("quiet -- print nothing\n"); model_print("time -- time execution of scanalysis\n"); model_print("\n"); @@ -94,12 +101,21 @@ void SCAnalysis::analyze(action_list_t *actions) { gettimeofday(&start, NULL); action_list_t *list = generateSC(actions); check_rf(list); - if (print_always || (print_buggy && execution->have_bug_reports())) + if (print_always || (print_buggy && execution->have_bug_reports())|| (print_nonsc && cyclic)) print_list(list); if (time) { gettimeofday(&finish, NULL); stats->elapsedtime+=((finish.tv_sec*1000000+finish.tv_usec)-(start.tv_sec*1000000+start.tv_usec)); } + update_stats(); +} + +void SCAnalysis::update_stats() { + if (cyclic) { + stats->nonsccount++; + } else { + stats->sccount++; + } } void SCAnalysis::check_rf(action_list_t *list) { diff --git a/scanalysis.h b/scanalysis.h index d68f4c1..988c8f7 100644 --- a/scanalysis.h +++ b/scanalysis.h @@ -5,6 +5,8 @@ struct sc_statistics { unsigned long long elapsedtime; + unsigned int sccount; + unsigned int nonsccount; }; class SCAnalysis : public TraceAnalysis { @@ -20,6 +22,7 @@ class SCAnalysis : public TraceAnalysis { SNAPSHOTALLOC private: + void update_stats(); void print_list(action_list_t *list); int buildVectors(action_list_t *); bool updateConstraints(ModelAction *act); @@ -41,6 +44,7 @@ class SCAnalysis : public TraceAnalysis { ModelExecution *execution; bool print_always; bool print_buggy; + bool print_nonsc; bool time; struct sc_statistics *stats; };