2 * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef XWALK_COMMON_PROFILER_H_
18 #define XWALK_COMMON_PROFILER_H_
28 #define PROFILE_START() PrintProfileLog(__FUNCTION__, "START");
29 #define PROFILE_END() PrintProfileLog(__FUNCTION__, "END");
30 #define PROFILE(x) PrintProfileLog(__FUNCTION__, x);
32 void PrintProfileLog(const char* func, const char* tag);
36 explicit ScopeProfile(const char* step, const bool isStep);
42 struct timespec start_;
49 static StepProfile* GetInstance();
50 void Start(const char* step);
51 void End(const char* step);
55 typedef std::map<const std::string,
56 std::unique_ptr<ScopeProfile> > ProfileMapT;
62 #define SCOPE_PROFILE() \
63 common::ScopeProfile __profile(__PRETTY_FUNCTION__, false);
65 #define STEP_PROFILE_START(x) \
66 common::StepProfile::GetInstance()->Start(x)
68 #define STEP_PROFILE_END(x) \
69 common::StepProfile::GetInstance()->End(x)
72 #endif // XWALK_COMMON_PROFILER_H_