* Copyright (c) 2025 Huawei Technologies Co., Ltd.
* This program is free software, you can redistribute it and/or modify it under the terms and conditions of
* CANN Open Software License Agreement Version 2.0 (the "License").
* Please refer to the License for details. You may not use this file except in compliance with the License.
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY, OR FITNESS FOR A PARTICULAR PURPOSE.
* See LICENSE in the root of the software repository for the full text of the License.
*/
#include <benchmark/benchmark.h>
#include <chrono>
namespace gert{
uint64_t RecordData(){
auto start_time = std::chrono::steady_clock::now();
auto end_time = std::chrono::steady_clock::now();
return std::chrono::duration_cast<std::chrono::nanoseconds>(end_time - start_time).count();
}
static void test_record_time_duration(benchmark::State &state) {
uint64_t ret = 0;
for (auto _ : state) {
ret = RecordData();
}
}
BENCHMARK(test_record_time_duration);
};