-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for integer type master time channels. #101
- Loading branch information
Showing
8 changed files
with
307 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2024 Ingemar Hedvall | ||
* SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
#include <gtest/gtest.h> | ||
#include <list> | ||
#include <deque> | ||
#include <queue> | ||
#include "mdf/samplerecord.h" | ||
#include "mdf/mdfhelper.h" | ||
|
||
using namespace mdf; | ||
|
||
|
||
namespace mdf::test { | ||
|
||
TEST(TestQueueSpeed, TestList) { | ||
SampleRecord test_record; | ||
test_record.timestamp = MdfHelper::NowNs(); | ||
test_record.record_id = 1; | ||
test_record.record_buffer.resize(1000, 0); | ||
|
||
std::cout << std::endl; | ||
{ | ||
const uint64_t start_time = MdfHelper::NowNs(); | ||
std::list<SampleRecord> list; | ||
for (size_t sample = 0; sample < 1'000'000; ++sample) { | ||
list.push_back(test_record); | ||
} | ||
while (!list.empty()) { | ||
list.pop_front(); | ||
} | ||
const uint64_t run_time = MdfHelper::NowNs() - start_time; | ||
std::cout << "List Run Time (ms): " | ||
<< static_cast<double>(run_time) / 1'000'000 << std::endl; | ||
} | ||
|
||
{ | ||
const uint64_t start_time = MdfHelper::NowNs(); | ||
std::deque<SampleRecord> list; | ||
for (size_t sample = 0; sample < 1'000'000; ++sample) { | ||
list.push_back(test_record); | ||
} | ||
while (!list.empty()) { | ||
list.pop_front(); | ||
} | ||
const uint64_t run_time = MdfHelper::NowNs() - start_time; | ||
std::cout << "Deque Run Time (ms): " | ||
<< static_cast<double>(run_time) / 1'000'000 << std::endl; | ||
} | ||
|
||
{ | ||
const uint64_t start_time = MdfHelper::NowNs(); | ||
std::queue<SampleRecord> list; | ||
for (size_t sample = 0; sample < 1'000'000; ++sample) { | ||
list.push(test_record); | ||
} | ||
while (!list.empty()) { | ||
list.pop(); | ||
} | ||
const uint64_t run_time = MdfHelper::NowNs() - start_time; | ||
std::cout << "Queue Run Time (ms): " | ||
<< static_cast<double>(run_time) / 1'000'000 << std::endl; | ||
} | ||
std::cout << std::endl; | ||
} | ||
|
||
} // end namespace mdf::test |
Oops, something went wrong.