[cfe-commits] r159038 - in /cfe/trunk: lib/StaticAnalyzer/Core/ExplodedGraph.cpp tools/scan-build/ccc-analyzer tools/scan-build/scan-build

Anna Zaks ganna at apple.com
Fri Jun 22 15:08:12 PDT 2012


Author: zaks
Date: Fri Jun 22 17:08:12 2012
New Revision: 159038

URL: http://llvm.org/viewvc/llvm-project?rev=159038&view=rev
Log:
[analyzer]scan-build: report the total number of steps analyzer performs

This would be useful to investigate performance issues.

Modified:
    cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
    cfe/trunk/tools/scan-build/ccc-analyzer
    cfe/trunk/tools/scan-build/scan-build

Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp?rev=159038&r1=159037&r2=159038&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExplodedGraph.cpp Fri Jun 22 17:08:12 2012
@@ -11,6 +11,7 @@
 //  which represent a path-sensitive, intra-procedural "exploded graph."
 //
 //===----------------------------------------------------------------------===//
+#define DEBUG_TYPE "CoreEngine"
 
 #include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h"
 #include "clang/StaticAnalyzer/Core/PathSensitive/ObjCMessage.h"
@@ -20,11 +21,15 @@
 #include "llvm/ADT/DenseSet.h"
 #include "llvm/ADT/DenseMap.h"
 #include "llvm/ADT/SmallVector.h"
+#include "llvm/ADT/Statistic.h"
 #include <vector>
 
 using namespace clang;
 using namespace ento;
 
+STATISTIC(NumNodesWithMoreThanTwoSucc,
+            "The # of nodes with more than 2 successors.");
+
 //===----------------------------------------------------------------------===//
 // Node auditing.
 //===----------------------------------------------------------------------===//
@@ -170,6 +175,8 @@
   assert (!V->isSink());
   Preds.addNode(V, G);
   V->Succs.addNode(this, G);
+  if (V->Succs.size() == 3)
+    NumNodesWithMoreThanTwoSucc++;
 #ifndef NDEBUG
   if (NodeAuditor) NodeAuditor->AddEdge(V, this);
 #endif

Modified: cfe/trunk/tools/scan-build/ccc-analyzer
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/ccc-analyzer?rev=159038&r1=159037&r2=159038&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/ccc-analyzer (original)
+++ cfe/trunk/tools/scan-build/ccc-analyzer Fri Jun 22 17:08:12 2012
@@ -438,6 +438,9 @@
 # Get the constraints engine.
 my $ConstraintsModel = $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'};
 
+#Get the internal stats setting.
+my $InternalStats = $ENV{'CCC_ANALYZER_INTERNAL_STATS'};
+
 # Get the output format.
 my $OutputFormat = $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'};
 if (!defined $OutputFormat) { $OutputFormat = "html"; }
@@ -642,6 +645,10 @@
     if (defined $ConstraintsModel) {
       push @AnalyzeArgs, "-analyzer-constraints=$ConstraintsModel";
     }
+
+    if (defined $InternalStats) {
+      push @AnalyzeArgs, "-analyzer-stats";
+    }
     
     if (defined $Analyses) {
       push @AnalyzeArgs, split '\s+', $Analyses;

Modified: cfe/trunk/tools/scan-build/scan-build
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/scan-build/scan-build?rev=159038&r1=159037&r2=159038&view=diff
==============================================================================
--- cfe/trunk/tools/scan-build/scan-build (original)
+++ cfe/trunk/tools/scan-build/scan-build Fri Jun 22 17:08:12 2012
@@ -1025,7 +1025,8 @@
  -maxloop N - specifiy the number of times a block can be visited before giving
               up. Default is 4. Increase for more comprehensive coverage at a
               cost of speed.
-
+ -internal-stats - Generate internal analyzer statistics.
+ 
 CONTROLLING CHECKERS:
 
  A default group of checkers are always run unless explicitly disabled.
@@ -1194,6 +1195,7 @@
 my @AnalysesToRun;
 my $StoreModel;
 my $ConstraintsModel;
+my $InternalStats;
 my $OutputFormat = "html";
 my $AnalyzerStats = 0;
 my $MaxLoop = 0;
@@ -1325,6 +1327,12 @@
     $ConstraintsModel = shift @ARGV;
     next;
   }
+
+  if ($arg eq "-internal-stats") {
+    shift @ARGV;
+    $InternalStats = 1;
+    next;
+  }
   
   if ($arg eq "-plist") {
     shift @ARGV;
@@ -1442,6 +1450,9 @@
 if (defined $ConstraintsModel) {
   $ENV{'CCC_ANALYZER_CONSTRAINTS_MODEL'} = $ConstraintsModel;
 }
+if (defined $InternalStats) {
+  $ENV{'CCC_ANALYZER_INTERNAL_STATS'} = 1;
+}
 if (defined $OutputFormat) {
   $ENV{'CCC_ANALYZER_OUTPUT_FORMAT'} = $OutputFormat;
 }





More information about the cfe-commits mailing list