blob: a3c06701dae04bfdabd81202ac3045f6a367e8ec [file] [log] [blame]
Keun Soo Yimffb07ba2016-05-18 16:22:45 -07001/*
2 * Copyright 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 __VTS_MEASUREMENT_H__
18#define __VTS_MEASUREMENT_H__
19
20#if USE_CTIME
21#include <time.h>
22#else
23#include <sys/time.h>
24#endif
25
26#include <vector>
27
28using namespace std;
29
30
31namespace android {
32namespace vts {
33
34// Class to do measurements before and after calling a target function.
35class VtsMeasurement {
36 public:
37 VtsMeasurement() {}
38
39 // Starts the measurement
40 void Start();
41
42 // Stops the measurement and returns the measured values.
43 vector<float>* Stop();
44
45 private:
46 // data structure to keep the start time.
47#if USE_CTIME
48 struct timeval tv_;
49#else
50 timespec ts_;
51#endif
52};
53
54} // namespace vts
55} // namespace android
56
57#endif