summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_profiler/auto_tracking.h
blob: b443871427e40d994951b1fa84334876e32ae9b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_
#define CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_

#include "base/file_path.h"
#include "base/tracked_objects.h"

//------------------------------------------------------------------------------
// Provide simple way to to start global tracking, and to tear down tracking
// when done.  The design has evolved to *not* do any teardown (and just leak
// all allocated data structures).  This class is currently used to ensure
// that the profiler data is output during shutdown, if this feature has been
// requested.

namespace task_profiler {

class AutoTracking {
 public:
  AutoTracking() {
    tracked_objects::ThreadData::Initialize();
  }

  ~AutoTracking();

  void set_output_file_path(const FilePath &path);

 private:
  FilePath output_file_path_;

  DISALLOW_COPY_AND_ASSIGN(AutoTracking);
};

}  // namespace task_profiler

#endif  // CHROME_BROWSER_TASK_PROFILER_AUTO_TRACKING_H_