blob: 3901f96b454acd43fadab9eb3e0fd430a21526e7 [file] [log] [blame]
Mathieu Chartier32ce2ad2016-03-04 14:58:03 -08001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef ART_RUNTIME_BASE_SYSTRACE_H_
18#define ART_RUNTIME_BASE_SYSTRACE_H_
19
20#define ATRACE_TAG ATRACE_TAG_DALVIK
21#include <cutils/trace.h>
22#include <string>
23#include <utils/Trace.h>
24
25namespace art {
26
27class ScopedTrace {
28 public:
29 explicit ScopedTrace(const char* name) {
30 ATRACE_BEGIN(name);
31 }
32
33 explicit ScopedTrace(const std::string& name) : ScopedTrace(name.c_str()) {}
34
35 ~ScopedTrace() {
36 ATRACE_END();
37 }
38};
39
40} // namespace art
41
42#endif // ART_RUNTIME_BASE_SYSTRACE_H_