Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Making sure statistics counters work as expected
- Loading branch information
Showing
6 changed files
with
44 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
|
||
set(tests | ||
discover_counters_1787 | ||
statistics_2666 | ||
uptime_1737) | ||
|
||
if(HPX_WITH_PAPI) | ||
|
27 changes: 27 additions & 0 deletions
27
tests/regressions/performance_counters/statistics_2666.cpp
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,27 @@ | ||
// Copyright (c) 2017 Hartmut Kaiser | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See accompanying | ||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <hpx/hpx.hpp> | ||
#include <hpx/hpx_main.hpp> | ||
#include <hpx/util/lightweight_test.hpp> | ||
|
||
int main() | ||
{ | ||
using hpx::performance_counters::performance_counter; | ||
|
||
performance_counter average("/statistics{/runtime/uptime}/average@200"); | ||
average.start(hpx::launch::sync); | ||
|
||
hpx::this_thread::sleep_for(std::chrono::seconds(1)); | ||
double val1 = average.get_value<double>(hpx::launch::sync); | ||
hpx::this_thread::sleep_for(std::chrono::seconds(1)); | ||
double val2 = average.get_value<double>(hpx::launch::sync); | ||
|
||
HPX_TEST_NEQ(val1, val2); | ||
|
||
average.stop(hpx::launch::sync); | ||
|
||
return hpx::util::report_errors(); | ||
} |