2 * Copyright (C) 2015 The Android Open Source Project
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 SIMPLE_PERF_UTILS_H_
18 #define SIMPLE_PERF_UTILS_H_
26 #define ALIGN(value, alignment) (((value) + (alignment)-1) & ~((alignment)-1))
30 LineReader(FILE* fp) : fp_(fp), buf_(nullptr), bufsize_(0) {
39 if (getline(&buf_, &bufsize_, fp_) != -1) {
45 size_t MaxLineSize() {
55 void PrintIndented(size_t indent, const char* fmt, ...);
57 bool IsPowerOfTwo(uint64_t value);
59 bool NextArgumentOrError(const std::vector<std::string>& args, size_t* pi);
61 void GetEntriesInDir(const std::string& dirpath, std::vector<std::string>* files,
62 std::vector<std::string>* subdirs);
64 #endif // SIMPLE_PERF_UTILS_H_