print some stats in SC Analysis
authorBrian Demsky <bdemsky@uci.edu>
Mon, 6 May 2013 23:28:44 +0000 (16:28 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Mon, 6 May 2013 23:28:44 +0000 (16:28 -0700)
scanalysis.cc
scanalysis.h

index 96dec70694d3264f40fee10633c340beef22b0fd..17763870814aeac14e528bcef8aa7b02e902e947 100644 (file)
@@ -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) {
index d68f4c114f43d71fdd646ec945861d701182cc39..988c8f75c13ad58f0fdfc44ebd3e936bb59601e1 100644 (file)
@@ -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;
 };