mirror of
https://github.com/mmueller41/mxtasking.git
synced 2026-01-21 12:42:57 +01:00
Include core allocation in time measurement.
This commit is contained in:
@@ -4,6 +4,9 @@
|
|||||||
#include <json.hpp>
|
#include <json.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <mx/memory/global_heap.h>
|
#include <mx/memory/global_heap.h>
|
||||||
|
#include <runtime/thread.h>
|
||||||
|
|
||||||
|
#define SHENANGO
|
||||||
|
|
||||||
using namespace application::blinktree_benchmark;
|
using namespace application::blinktree_benchmark;
|
||||||
|
|
||||||
@@ -26,6 +29,7 @@ Benchmark::Benchmark(benchmark::Cores &&cores, const std::uint16_t iterations, s
|
|||||||
//this->_chronometer.add(benchmark::Perf::STALLS_MEM_ANY);
|
//this->_chronometer.add(benchmark::Perf::STALLS_MEM_ANY);
|
||||||
//this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_NTA);
|
//this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_NTA);
|
||||||
//this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_WRITE);
|
//this->_chronometer.add(benchmark::Perf::SW_PREFETCH_ACCESS_WRITE);
|
||||||
|
this->_chronometer.add(benchmark::Perf::L1_MISSES);
|
||||||
this->_chronometer.add(benchmark::Perf::LLC_MISSES);
|
this->_chronometer.add(benchmark::Perf::LLC_MISSES);
|
||||||
this->_chronometer.add(benchmark::Perf::DTLB_READ_MISSES);
|
this->_chronometer.add(benchmark::Perf::DTLB_READ_MISSES);
|
||||||
this->_chronometer.add(benchmark::Perf::DTLB_STORE_MISSES);
|
this->_chronometer.add(benchmark::Perf::DTLB_STORE_MISSES);
|
||||||
@@ -79,8 +83,9 @@ void Benchmark::start()
|
|||||||
{
|
{
|
||||||
mx::tasking::runtime::profile(this->profile_file_name());
|
mx::tasking::runtime::profile(this->profile_file_name());
|
||||||
}
|
}
|
||||||
|
|
||||||
//this->_chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(this->_workload)),
|
//this->_chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(this->_workload)),
|
||||||
// this->_current_iteration + 1, this->_cores.current());
|
// this->_current_iteration + 1, this->_cores.current());
|
||||||
}
|
}
|
||||||
|
|
||||||
const mx::util::core_set &Benchmark::core_set()
|
const mx::util::core_set &Benchmark::core_set()
|
||||||
@@ -120,8 +125,8 @@ void Benchmark::requests_finished()
|
|||||||
|
|
||||||
if (open_requests == 0U) // All request schedulers are done.
|
if (open_requests == 0U) // All request schedulers are done.
|
||||||
{
|
{
|
||||||
std::uint16_t core_id = mx::system::topology::core_id();
|
auto core_id = get_current_affinity();
|
||||||
/*if (core_id != 0) {
|
/* if (core_id != start_core) {
|
||||||
this->_open_requests++;
|
this->_open_requests++;
|
||||||
auto *stop_task = mx::tasking::runtime::new_task<StopMeasurementTask>(0U, *this);
|
auto *stop_task = mx::tasking::runtime::new_task<StopMeasurementTask>(0U, *this);
|
||||||
stop_task->annotate(static_cast<mx::tasking::TaskInterface::channel>(0));
|
stop_task->annotate(static_cast<mx::tasking::TaskInterface::channel>(0));
|
||||||
@@ -209,10 +214,20 @@ void Benchmark::requests_finished()
|
|||||||
this->_tree.reset(nullptr);
|
this->_tree.reset(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto *restart_task = mx::tasking::runtime::new_task<RestartTask>(0U, *this);
|
if (this->core_set())
|
||||||
restart_task->annotate(static_cast<mx::tasking::TaskInterface::channel>(0));
|
{
|
||||||
mx::tasking::runtime::spawn(*restart_task, core_id);
|
this->_chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(this->_workload)),
|
||||||
mx::tasking::runtime::resume();
|
this->_current_iteration + 1, this->_cores.current());
|
||||||
|
auto *restart_task = mx::tasking::runtime::new_task<RestartTask>(0U, *this);
|
||||||
|
restart_task->annotate(static_cast<mx::tasking::TaskInterface::channel>(0));
|
||||||
|
mx::tasking::runtime::spawn(*restart_task, core_id);
|
||||||
|
mx::tasking::runtime::resume();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
std::cout << "Benchmark finished." << std::endl;
|
||||||
|
mx::tasking::runtime::stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -47,6 +47,11 @@ public:
|
|||||||
*/
|
*/
|
||||||
void start();
|
void start();
|
||||||
|
|
||||||
|
void start_chronometer() {
|
||||||
|
this->_chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(this->_workload)),
|
||||||
|
this->_current_iteration + 1, this->_cores.current());
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Collection of cores the benchmark should run on.
|
// Collection of cores the benchmark should run on.
|
||||||
benchmark::Cores _cores;
|
benchmark::Cores _cores;
|
||||||
@@ -101,6 +106,7 @@ private:
|
|||||||
*/
|
*/
|
||||||
[[nodiscard]] std::string profile_file_name() const;
|
[[nodiscard]] std::string profile_file_name() const;
|
||||||
|
|
||||||
|
std::uint16_t start_core{0};
|
||||||
friend class StartMeasurementTask;
|
friend class StartMeasurementTask;
|
||||||
friend class StopMeasurementTask;
|
friend class StopMeasurementTask;
|
||||||
};
|
};
|
||||||
@@ -116,7 +122,7 @@ class StartMeasurementTask : public mx::tasking::TaskInterface
|
|||||||
|
|
||||||
mx::tasking::TaskResult execute(const std::uint16_t, const std::uint16_t) override
|
mx::tasking::TaskResult execute(const std::uint16_t, const std::uint16_t) override
|
||||||
{
|
{
|
||||||
_benchmark._chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(_benchmark._workload)), _benchmark._current_iteration + 1, _benchmark._cores.current());
|
//_benchmark._chronometer.start(static_cast<std::uint16_t>(static_cast<benchmark::phase>(_benchmark._workload)), _benchmark._current_iteration + 1, _benchmark._cores.current());
|
||||||
std::cout << "Started benchmark" << std::endl;
|
std::cout << "Started benchmark" << std::endl;
|
||||||
return mx::tasking::TaskResult::make_remove();
|
return mx::tasking::TaskResult::make_remove();
|
||||||
}
|
}
|
||||||
@@ -147,15 +153,7 @@ public:
|
|||||||
|
|
||||||
mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t channel_id) override
|
mx::tasking::TaskResult execute(const std::uint16_t core_id, const std::uint16_t channel_id) override
|
||||||
{
|
{
|
||||||
if (_benchmark.core_set())
|
_benchmark.start();
|
||||||
{
|
|
||||||
_benchmark.start();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
std::cout << "Benchmark finished." << std::endl;
|
|
||||||
mx::tasking::runtime::stop();
|
|
||||||
}
|
|
||||||
return mx::tasking::TaskResult::make_remove();
|
return mx::tasking::TaskResult::make_remove();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ int main(int count_arguments, char **arguments)
|
|||||||
while ((cores = benchmark->core_set()))
|
while ((cores = benchmark->core_set()))
|
||||||
{
|
{
|
||||||
mx::tasking::runtime_guard _(use_system_allocator, cores, prefetch_distance);
|
mx::tasking::runtime_guard _(use_system_allocator, cores, prefetch_distance);
|
||||||
|
benchmark->start_chronometer();
|
||||||
benchmark->start();
|
benchmark->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user