/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "MozGTestBench.h" #include "mozilla/TimeStamp.h" #include #include #include #define MOZ_GTEST_BENCH_FRAMEWORK "platform_microbench" #define MOZ_GTEST_NUM_ITERATIONS 5 using mozilla::TimeStamp; namespace mozilla { void GTestBench(const char* aSuite, const char* aName, const std::function& aTest) { #if defined(DEBUG) || defined(MOZ_ASAN) // Run the test to make sure that it doesn't fail but don't log // any measurements since it's not an optimized build. aTest(); #else bool shouldAlert = bool(getenv("PERFHERDER_ALERTING_ENABLED")); std::vector durations; for (int i=0; i