Skip to content

Commit f4bebad

Browse files
yhmtsaiSlaedr
andcommitted
use standard way to output duration in seconds
Co-authored-by: Aditya Kashi <aditya.kashi@kit.edu>
1 parent 52a9d81 commit f4bebad

3 files changed

Lines changed: 13 additions & 76 deletions

File tree

benchmark/utils/chrono_utils.hpp

Lines changed: 0 additions & 62 deletions
This file was deleted.

benchmark/utils/loggers.hpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4343
#include <unordered_map>
4444

4545

46-
#include "benchmark/utils/chrono_utils.hpp"
4746
#include "benchmark/utils/general.hpp"
4847

4948

@@ -110,7 +109,9 @@ struct OperationLogger : gko::log::Logger {
110109
for (const auto &entry : total) {
111110
add_or_set_member(
112111
object, entry.first.c_str(),
113-
get_duration_in_seconds(entry.second) / repetitions, alloc);
112+
std::chrono::duration<double>(entry.second).count() /
113+
repetitions,
114+
alloc);
114115
}
115116
}
116117

@@ -204,9 +205,10 @@ struct ResidualLogger : gko::log::Logger {
204205
const gko::LinOp *solution,
205206
const gko::LinOp *residual_norm) const override
206207
{
207-
timestamps.PushBack(
208-
get_duration_in_seconds(std::chrono::steady_clock::now() - start),
209-
alloc);
208+
timestamps.PushBack(std::chrono::duration<double>(
209+
std::chrono::steady_clock::now() - start)
210+
.count(),
211+
alloc);
210212
if (residual_norm) {
211213
rec_res_norms.PushBack(
212214
get_norm(gko::as<vec<ValueType>>(residual_norm)), alloc);

benchmark/utils/timer.hpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
4040
#include <gflags/gflags.h>
4141

4242

43-
#include "benchmark/utils/chrono_utils.hpp"
44-
45-
4643
#ifdef HAS_CUDA
4744

4845

@@ -165,13 +162,13 @@ class Timer {
165162
/**
166163
* Put the second result into vector
167164
*
168-
* @param ns the second result to insert
165+
* @param sec the second result to insert
169166
*/
170-
void add_record(double ns)
167+
void add_record(double sec)
171168
{
172169
// add the result;
173-
duration_sec_.emplace_back(ns);
174-
total_duration_sec_ += ns;
170+
duration_sec_.emplace_back(sec);
171+
total_duration_sec_ += sec;
175172
}
176173

177174
/**
@@ -218,8 +215,8 @@ class CpuTimer : public Timer {
218215
{
219216
exec_->synchronize();
220217
auto stop = std::chrono::steady_clock::now();
221-
auto duration_time = get_duration_in_seconds(stop - start_);
222-
return duration_time;
218+
std::chrono::duration<double> duration_time = stop - start_;
219+
return duration_time.count();
223220
}
224221

225222
private:

0 commit comments

Comments
 (0)