New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unable to register new performance counter #2480
Comments
On Freitag, 3. Februar 2017 08:28:19 CET Adrian Serio wrote:
I am unable to register a new performance counter though I am following the
pattern outlined in simplest_performance_counter.cpp My code seg. faults
when I try to run the application with
`--hpx:print-counter=/test/new_counter`
I have my code below:
```
#include <hpx/hpx_main.hpp>
#include <hpx/include/iostreams.hpp>
#include <hpx/include/performance_counters.hpp>
////////////////////////////////////////////////////////////////////////////
/// //New counter
std::int64_t new_query(bool reset) {
return hpx::get_locality_id();
}
void new_counter() {
hpx::performance_counters::install_counter_type(
"/test/new_counter",
&new_query,
"returns the locality"
);
}
////////////////////////////////////////////////////////////////////////////
/// int main()
{
hpx::register_startup_function(&new_counter);
return hpx::init();
}
int hpx_main()
{
int a=0;
hpx::performance_counters::performance_counter
counter("/threads/count/cumulative");
The segfault should happen around here, it should go away when you explicitly
start the performance counter, as done here:
https://github.com/STEllAR-GROUP/hpx/blob/master/examples/
performance_counters/sine/sine_client.cpp#L72
… hpx::cout<<"Number of threads:
"<<counter.get_value<int>().get()<<std::endl;
hpx::cout<<"New Counter: "<<hpx::get_locality_id()<<std::endl;
hpx::cout<<"How many times should I say hello?\n"<<hpx::flush;
std::cin>>a;
for (int i=0; i<a; i++) {
//Say hello to the world!
hpx::cout<<"Hello World\n"<<hpx::flush;
}
hpx::finalize();
}
```
|
@sithhell adding new_counter.start() doesn't compile as new_counter is not a class. I am creating the counter as shown in https://github.com/STEllAR-GROUP/hpx/blob/master/examples/performance_counters/simplest_performance_counter.cpp I have compiled and ran simplest_performance_counter.cpp and it works... which confuses me more... |
@aserio Did you resolve your problem in the end? |
You will need to replace
|
I am unable to register a new performance counter though I am following the pattern outlined in simplest_performance_counter.cpp My code seg. faults when I try to run the application with
--hpx:print-counter=/test/new_counter
I have my code below:
The text was updated successfully, but these errors were encountered: