1 /* 2 * Copyright (C) 2019 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 #include "RandomGraphGeneratorUtils.h" 18 19 #include <algorithm> 20 #include <iomanip> 21 #include <memory> 22 #include <sstream> 23 #include <string> 24 #include <vector> 25 26 #include "RandomGraphGenerator.h" 27 #include "RandomVariable.h" 28 29 namespace android { 30 namespace nn { 31 namespace fuzzing_test { 32 33 std::mt19937 RandomNumberGenerator::generator; 34 getElapsedTime()35std::string Logger::getElapsedTime() { 36 auto end = std::chrono::high_resolution_clock::now(); 37 int ms = std::chrono::duration_cast<std::chrono::milliseconds>(end - mStart).count(); 38 int hour = ms / 3600000; 39 int minutes = (ms % 3600000) / 60000; 40 int seconds = (ms % 60000) / 1000; 41 int milli = ms % 1000; 42 std::ostringstream oss; 43 oss << std::setfill('0') << std::setw(2) << hour << ":" << std::setw(2) << minutes << ":" 44 << std::setw(2) << seconds << "." << std::setw(3) << milli << " "; 45 return oss.str(); 46 } 47 48 } // namespace fuzzing_test 49 } // namespace nn 50 } // namespace android 51