Random sampling (aka Arnold and Ryder) profiling. This is still preliminary, but...
[oota-llvm.git] / lib / Transforms / Instrumentation / RSProfiling.h
1 //===- RSProfiling.cpp - Various profiling using random sampling ----------===//
2 //
3 //                      The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // See notes in RSProfiling.cpp
11 //
12 //===----------------------------------------------------------------------===//
13
14 namespace llvm {
15   // By default, we provide some convienence stuff to clients, so they 
16   // can just store the instructions they create to do profiling.
17   // also, handle all chaining issues.
18   // a client is free to overwrite these, as long as it implements the
19   // chaining itself.
20   struct RSProfilers : public ModulePass {
21     std::set<Value*> profcode;
22     virtual bool isProfiling(Value* v);
23     virtual ~RSProfilers() {}
24     virtual void getAnalysisUsage(AnalysisUsage &AU) const;
25     void IncrementCounterInBlock(BasicBlock *BB, unsigned CounterNum,
26                                  GlobalValue *CounterArray);
27   };
28 };