klee
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
StatsTracker.h
Go to the documentation of this file.
1 //===-- StatsTracker.h ------------------------------------------*- C++ -*-===//
2 //
3 // The KLEE Symbolic Virtual Machine
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef KLEE_STATSTRACKER_H
11 #define KLEE_STATSTRACKER_H
12 
13 #include "CallPathManager.h"
14 
15 #include <set>
16 
17 namespace llvm {
18  class BranchInst;
19  class Function;
20  class Instruction;
21  class raw_fd_ostream;
22 }
23 
24 namespace klee {
25  class ExecutionState;
26  class Executor;
27  class InstructionInfoTable;
28  class InterpreterHandler;
29  struct KInstruction;
30  struct StackFrame;
31 
32  class StatsTracker {
33  friend class WriteStatsTimer;
34  friend class WriteIStatsTimer;
35 
37  std::string objectFilename;
38 
39  llvm::raw_fd_ostream *statsFile, *istatsFile;
40  double startWallTime;
41 
42  unsigned numBranches;
44 
46 
48 
49  public:
50  static bool useStatistics();
51 
52  private:
53  void updateStateStatistics(uint64_t addend);
54  void writeStatsHeader();
55  void writeStatsLine();
56  void writeIStats();
57 
58  public:
59  StatsTracker(Executor &_executor, std::string _objectFilename,
60  bool _updateMinDistToUncovered);
61  ~StatsTracker();
62 
63  // called after a new StackFrame has been pushed (for callpath tracing)
64  void framePushed(ExecutionState &es, StackFrame *parentFrame);
65 
66  // called after a StackFrame has been popped
67  void framePopped(ExecutionState &es);
68 
69  // called when some side of a branch has been visited. it is
70  // imperative that this be called when the statistics index is at
71  // the index for the branch itself.
72  void markBranchVisited(ExecutionState *visitedTrue,
73  ExecutionState *visitedFalse);
74 
75  // called when execution is done and stats files should be flushed
76  void done();
77 
78  // process stats for a single instruction step, es is the state
79  // about to be stepped
81 
83  double elapsed();
84 
86  };
87 
88  uint64_t computeMinDistToUncovered(const KInstruction *ki,
89  uint64_t minDistAtRA);
90 
91 }
92 
93 #endif
void framePopped(ExecutionState &es)
unsigned partialBranches
Definition: StatsTracker.h:43
Executor & executor
Definition: StatsTracker.h:36
unsigned numBranches
Definition: StatsTracker.h:42
void markBranchVisited(ExecutionState *visitedTrue, ExecutionState *visitedFalse)
void framePushed(ExecutionState &es, StackFrame *parentFrame)
StatsTracker(Executor &_executor, std::string _objectFilename, bool _updateMinDistToUncovered)
static bool useStatistics()
uint64_t computeMinDistToUncovered(const KInstruction *ki, uint64_t minDistAtRA)
CallPathManager callPathManager
Definition: StatsTracker.h:45
void stepInstruction(ExecutionState &es)
bool updateMinDistToUncovered
Definition: StatsTracker.h:47
std::string objectFilename
Definition: StatsTracker.h:37
void updateStateStatistics(uint64_t addend)
unsigned fullBranches
Definition: StatsTracker.h:43
void computeReachableUncovered()
llvm::raw_fd_ostream * istatsFile
Definition: StatsTracker.h:39
llvm::raw_fd_ostream * statsFile
Definition: StatsTracker.h:39
double elapsed()
Return time in seconds since execution start.