Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions core/tests/local_bump_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Monotonic;
using join::BumpPlain;
using join::LocalMem;
using join::Thread;
using join::Rdtsc;

/**
* @brief test move.
Expand Down Expand Up @@ -291,13 +291,13 @@ TEST (LocalBump, benchmark)
});
}

Rdtsc::Stats aStats ("allocate");
Monotonic::Stats aStats ("allocate");

for (int i = 0; i < iterations; ++i)
{
void* p = nullptr;
{
ScopedStats<Rdtsc::Stats> guard (aStats);
ScopedStats<Monotonic::Stats> guard (aStats);
p = allocator.allocate (16);
}
EXPECT_NE (p, nullptr);
Expand All @@ -314,13 +314,13 @@ TEST (LocalBump, benchmark)
LocalMem::BumpAllocator<iterations * 16, BumpPlain> plain;
plain.mlock ();

Rdtsc::Stats pStats ("allocate plain");
Monotonic::Stats pStats ("allocate plain");

for (int i = 0; i < iterations; ++i)
{
void* p = nullptr;
{
ScopedStats<Rdtsc::Stats> guard (pStats);
ScopedStats<Monotonic::Stats> guard (pStats);
p = plain.allocate (16);
}
EXPECT_NE (p, nullptr);
Expand All @@ -336,7 +336,6 @@ TEST (LocalBump, benchmark)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/local_mpmc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::LocalMem;
using join::Thread;

Expand Down Expand Up @@ -291,7 +291,7 @@ TEST (LocalMpmc, pushBenchmark)
}
}
ready.store (true, std::memory_order_release);
Rdtsc::Stats stats ("MPMC push");
Monotonic::Stats stats ("MPMC push");
for (int i = 0; i < numProducers; ++i)
{
producers.emplace_back ([&] () {
Expand All @@ -302,7 +302,7 @@ TEST (LocalMpmc, pushBenchmark)
}
for (uint64_t j = 0; j < msgPerProducer; ++j)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.push (localData), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -373,14 +373,14 @@ TEST (LocalMpmc, popBenchmark)
}
ready.store (true, std::memory_order_release);
std::vector<Thread> consumers;
Rdtsc::Stats stats ("MPMC pop");
Monotonic::Stats stats ("MPMC pop");
for (int p = 0; p < numConsumers; ++p)
{
consumers.emplace_back ([&] () {
uint64_t threadData = 0;
for (uint64_t i = 0; i < msgPerConsumer; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.pop (threadData), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -483,7 +483,6 @@ TEST (LocalMpmc, mbind)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/local_mpsc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::LocalMem;
using join::Thread;

Expand Down Expand Up @@ -293,13 +293,13 @@ TEST (LocalMpsc, pushBenchmark)
}
}
ready.store (true, std::memory_order_release);
Rdtsc::Stats stats ("MPSC push");
Monotonic::Stats stats ("MPSC push");
for (int p = 0; p < numProducers; ++p)
{
producers.emplace_back ([&] () {
for (uint64_t i = 0; i < msgPerProducer; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.push (data), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -348,10 +348,10 @@ TEST (LocalMpsc, popBenchmark)

uint64_t data = 0;
ready.store (true, std::memory_order_release);
Rdtsc::Stats stats ("MPSC pop");
Monotonic::Stats stats ("MPSC pop");
for (uint64_t i = 0; i < num; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.pop (data), 0) << join::lastError.message ();
}
for (auto& p : producers)
Expand Down Expand Up @@ -439,7 +439,6 @@ TEST (LocalMpsc, mbind)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/local_slab_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::LocalMem;
using join::Thread;

Expand Down Expand Up @@ -276,20 +276,20 @@ TEST (LocalSlab, benchmark)
});
}

Rdtsc::Stats aStats ("allocate");
Rdtsc::Stats dStats ("deallocate");
Monotonic::Stats aStats ("allocate");
Monotonic::Stats dStats ("deallocate");

for (int i = 0; i < iterations; ++i)
{
void* p = nullptr;
{
ScopedStats<Rdtsc::Stats> guard (aStats);
ScopedStats<Monotonic::Stats> guard (aStats);
p = allocator.allocate (64);
}
EXPECT_NE (p, nullptr);
if (p)
{
ScopedStats<Rdtsc::Stats> guard (dStats);
ScopedStats<Monotonic::Stats> guard (dStats);
allocator.deallocate (p);
}
}
Expand All @@ -309,7 +309,6 @@ TEST (LocalSlab, benchmark)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/local_spsc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::LocalMem;
using join::Thread;

Expand Down Expand Up @@ -348,11 +348,11 @@ TEST (LocalSpsc, pushBenchmark)
}

ready.store (true, std::memory_order_release);
Rdtsc::Stats stats ("SPSC push");
Monotonic::Stats stats ("SPSC push");

for (uint64_t i = 0; i < num; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.push (data), 0) << join::lastError.message ();
}

Expand Down Expand Up @@ -392,11 +392,11 @@ TEST (LocalSpsc, popBenchmark)
}

uint64_t data = 0;
Rdtsc::Stats stats ("SPSC pop");
Monotonic::Stats stats ("SPSC pop");

for (uint64_t i = 0; i < num; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (queue.pop (data), 0) << join::lastError.message ();
}

Expand Down Expand Up @@ -482,7 +482,6 @@ TEST (LocalSpsc, mbind)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/shm_mpmc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::Semaphore;
using join::ShmMem;
using join::Thread;
Expand Down Expand Up @@ -358,14 +358,14 @@ TEST_F (ShmMpmc, pushBenchmark)
}
}
sem.post ();
Rdtsc::Stats stats ("MPMC push");
Monotonic::Stats stats ("MPMC push");
for (int p = 0; p < numProducers; ++p)
{
producers.emplace_back ([&] () {
ShmMem::Mpmc::Queue<uint64_t> prod (capacity, _name);
for (uint64_t i = 0; i < msgPerProducer; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (prod.push (data), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -437,15 +437,15 @@ TEST_F (ShmMpmc, popBenchmark)
const uint64_t msgPerConsumer = num / numConsumers;
Semaphore sem (_name);
sem.wait ();
Rdtsc::Stats stats ("MPMC pop");
Monotonic::Stats stats ("MPMC pop");
for (int p = 0; p < numConsumers; ++p)
{
consumers.emplace_back ([&] () {
ShmMem::Mpmc::Queue<uint64_t> cons (capacity, _name);
uint64_t data = 0;
for (uint64_t i = 0; i < msgPerConsumer; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (cons.pop (data), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -550,7 +550,6 @@ TEST_F (ShmMpmc, mbind)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/shm_mpsc_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::Semaphore;
using join::ShmMem;
using join::Thread;
Expand Down Expand Up @@ -344,14 +344,14 @@ TEST_F (ShmMpsc, pushBenchmark)
}
}
sem.post ();
Rdtsc::Stats stats ("MPSC push");
Monotonic::Stats stats ("MPSC push");
for (int p = 0; p < numProducers; ++p)
{
producers.emplace_back ([&] () {
ShmMem::Mpsc::Queue<uint64_t> prod (capacity, _name);
for (uint64_t i = 0; i < msgPerProducer; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (prod.push (data), 0) << join::lastError.message ();
}
});
Expand Down Expand Up @@ -413,10 +413,10 @@ TEST_F (ShmMpsc, popBenchmark)
Semaphore sem (_name);
sem.wait ();
ShmMem::Mpsc::Queue<uint64_t> cons (capacity, _name);
Rdtsc::Stats stats ("MPSC pop");
Monotonic::Stats stats ("MPSC pop");
for (uint64_t i = 0; i < num; ++i)
{
ScopedStats<Rdtsc::Stats> guard (stats);
ScopedStats<Monotonic::Stats> guard (stats);
EXPECT_EQ (cons.pop (data), 0) << join::lastError.message ();
}
std::cout << join::statsHeader << "\n";
Expand Down Expand Up @@ -506,7 +506,6 @@ TEST_F (ShmMpsc, mbind)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
11 changes: 5 additions & 6 deletions core/tests/shm_slab_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <gtest/gtest.h>

using join::ScopedStats;
using join::Rdtsc;
using join::Monotonic;
using join::ShmMem;

/**
Expand Down Expand Up @@ -303,20 +303,20 @@ TEST_F (ShmSlab, benchmark)
pids.push_back (pid);
}

Rdtsc::Stats aStats ("allocate");
Rdtsc::Stats dStats ("deallocate");
Monotonic::Stats aStats ("allocate");
Monotonic::Stats dStats ("deallocate");

for (int i = 0; i < iterations; ++i)
{
void* p = nullptr;
{
ScopedStats<Rdtsc::Stats> guard (aStats);
ScopedStats<Monotonic::Stats> guard (aStats);
p = allocator.allocate (64);
}
EXPECT_NE (p, nullptr);
if (p)
{
ScopedStats<Rdtsc::Stats> guard (dStats);
ScopedStats<Monotonic::Stats> guard (dStats);
allocator.deallocate (p);
}
}
Expand All @@ -338,7 +338,6 @@ TEST_F (ShmSlab, benchmark)
*/
int main (int argc, char** argv)
{
Rdtsc::calibrate ();
testing::InitGoogleTest (&argc, argv);
return RUN_ALL_TESTS ();
}
Loading
Loading