summaryrefslogtreecommitdiffstats
path: root/runtime/base/timing_logger.h
diff options
context:
space:
mode:
authorIan Rogers <irogers@google.com>2013-11-14 00:17:20 -0800
committerIan Rogers <irogers@google.com>2013-11-14 14:59:57 -0800
commit5fe9af720048673e62ee29597a30bb9e54c903c5 (patch)
tree733dca70511f4798a3082b084a9a3d6da9f5914a /runtime/base/timing_logger.h
parentdfe78a6e6b526d482298100a1f6392a8c7105522 (diff)
downloadart-5fe9af720048673e62ee29597a30bb9e54c903c5.zip
art-5fe9af720048673e62ee29597a30bb9e54c903c5.tar.gz
art-5fe9af720048673e62ee29597a30bb9e54c903c5.tar.bz2
Fix memory leaks relating to timing logger.
Bug: 11670287. We use pointers to uninitialized values for control-flow in the timing logger code, add TODO comments to clean this up later. Remove base namespace and other bits of tidying. Change-Id: I1e6600a1e92f974c8f58f3a405a4e4abb4d9f80f
Diffstat (limited to 'runtime/base/timing_logger.h')
-rw-r--r--runtime/base/timing_logger.h18
1 files changed, 6 insertions, 12 deletions
diff --git a/runtime/base/timing_logger.h b/runtime/base/timing_logger.h
index 501d2d7..f1f7855 100644
--- a/runtime/base/timing_logger.h
+++ b/runtime/base/timing_logger.h
@@ -26,10 +26,7 @@
#include <map>
namespace art {
-
-namespace base {
- class TimingLogger;
-} // namespace base
+class TimingLogger;
class CumulativeLogger {
public:
@@ -44,7 +41,7 @@ class CumulativeLogger {
// Allow the name to be modified, particularly when the cumulative logger is a field within a
// parent class that is unable to determine the "name" of a sub-class.
void SetName(const std::string& name);
- void AddLogger(const base::TimingLogger& logger) LOCKS_EXCLUDED(lock_);
+ void AddLogger(const TimingLogger& logger) LOCKS_EXCLUDED(lock_);
size_t GetIterations() const;
private:
@@ -65,19 +62,17 @@ class CumulativeLogger {
DISALLOW_COPY_AND_ASSIGN(CumulativeLogger);
};
-namespace base {
-
-
// A timing logger that knows when a split starts for the purposes of logging tools, like systrace.
class TimingLogger {
public:
// Splits are nanosecond times and split names.
typedef std::pair<uint64_t, const char*> SplitTiming;
typedef std::vector<SplitTiming> SplitTimings;
- typedef std::vector<SplitTiming>::const_iterator SplitTimingsIterator;
explicit TimingLogger(const char* name, bool precise, bool verbose);
-
+ ~TimingLogger() {
+ // TODO: DCHECK(current_split_ == nullptr) << "Forgot to end split: " << current_split_->label_;
+ }
// Clears current splits and labels.
void Reset();
@@ -143,7 +138,7 @@ class TimingLogger {
friend class ScopedSplit;
protected:
// The name of the timing logger.
- const char* name_;
+ const char* const name_;
// Do we want to print the exactly recorded split (true) or round down to the time unit being
// used (false).
@@ -162,7 +157,6 @@ class TimingLogger {
DISALLOW_COPY_AND_ASSIGN(TimingLogger);
};
-} // namespace base
} // namespace art
#endif // ART_RUNTIME_BASE_TIMING_LOGGER_H_