diff options
author | Chris Lattner <sabre@nondot.org> | 2002-04-04 19:21:27 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2002-04-04 19:21:27 +0000 |
commit | 1f1170c94a5a36e1767a10427c67429c68550243 (patch) | |
tree | e0a9844640499255502966189927c20080ccf52c /lib/Analysis/DataStructure | |
parent | cc0c1b2e1845d30fb6da732a70cb9ad39eda5b85 (diff) |
Add hack to get timing of analysis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2101 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/DataStructure')
-rw-r--r-- | lib/Analysis/DataStructure/DataStructure.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Analysis/DataStructure/DataStructure.cpp b/lib/Analysis/DataStructure/DataStructure.cpp index 13d3dce174..01ef27383c 100644 --- a/lib/Analysis/DataStructure/DataStructure.cpp +++ b/lib/Analysis/DataStructure/DataStructure.cpp @@ -29,9 +29,29 @@ void DataStructure::releaseMemory() { DSInfo.clear(); } +// FIXME REMOVE +#include <sys/time.h> +#include "Support/CommandLine.h" + +cl::Flag Time("t", "Print analysis time..."); + // print - Print out the analysis results... void DataStructure::print(std::ostream &O, Module *M) const { + if (Time) { + timeval TV1, TV2; + gettimeofday(&TV1, 0); + for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) + if (!(*I)->isExternal()) { + getDSGraph(*I); + getClosedDSGraph(*I); + } + gettimeofday(&TV2, 0); + cerr << "Analysis took " + << (TV2.tv_sec-TV1.tv_sec)*1000000+(TV2.tv_usec-TV1.tv_usec) + << " microseconds.\n"; + } + for (Module::iterator I = M->begin(), E = M->end(); I != E; ++I) if (!(*I)->isExternal()) { @@ -52,6 +72,9 @@ void DataStructure::print(std::ostream &O, Module *M) const { } else { O << " error opening file for writing!\n"; } + + O << (*I)->getName() << " " << getDSGraph(*I).getGraphSize() << " " + << getClosedDSGraph(*I).getGraphSize() << "\n"; } } |