]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
tests/test_bluestore_types: cast duration to ceph::timespan 38882/head
authorKefu Chai <kchai@redhat.com>
Wed, 13 Jan 2021 13:01:43 +0000 (21:01 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 13 Jan 2021 13:05:30 +0000 (21:05 +0800)
on FreeBSD + Clang + libc++ + amd64, std::chrono::nanoseconds::rep is `long
long` instead of `long`, so the explictly instantiated template
operator<< operator instances in `src/common/ceph_time.cc` are not able to
cover this use case. so in this change, the duration is casted to
ceph::timespan instead of nanoseconds. so we can ensure that `operator<<` is
always available in this case.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/test/objectstore/test_bluestore_types.cc

index 6ddf717d605687906684c43a7d0e626646679c5b..a830915952affd102582c601fa87c604b7ba56b1 100644 (file)
@@ -326,7 +326,7 @@ TEST(bluestore_blob_t, csum_bench)
       b.calc_csum(0, bl);
     }
     ceph::mono_clock::time_point end = ceph::mono_clock::now();
-    auto dur = std::chrono::duration_cast<std::chrono::nanoseconds>(end - start);
+    auto dur = std::chrono::duration_cast<ceph::timespan>(end - start);
     double mbsec = (double)count * (double)bl.length() / 1000000.0 / (double)dur.count() * 1000000000.0;
     cout << "csum_type " << Checksummer::get_csum_type_string(csum_type)
         << ", " << dur << " seconds, "