Pipe micsmc output to a c++ app without writing to console

Pipe micsmc output to a c++ app without writing to console


I'm interested in doing some power analysis on the Xeon Phi and I'm trying to pipe the output of the micsmc tool into a c++ application. I have a bash script which calls micsmc -f periodically (approximately every 250ms); as is, the micsmc tool outputs the information to the console. I want to output this information instead to a c++ application (without writing the power and frequency data to the console). The c++ application would then need to collect the data and output it to a file.

I have the following c++ application:


    while (true)
        // process pipe if new data
        if (getline(cin, input))
            elapsedTime = timer.getTime();
            length = input.length();

            printf("Elapsed time: %0.2f\n", elapsedTime);
            //printf("Input: %s\n\n", input.c_str());

            // Store/process data here

I've tried to issue the following command in the shell:

$ ./script | ./pipe

When this runs

Is it possible to pipe the output ONLY to the c++ application and not to both the c++ application and to the console window? Or is there a better method for obtaining this power information from the device? I'm looking to extract power/frequency information approximately once every 250ms and determine whether or not to apply DVFS to the Host system. We would also like to perform DVFS on the Phi device, but my understanding is that is handled ONLY by the underlying OS.

Thank you

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Best Reply

Hi Gary, 

You might find the following threads useful: 



Hope this helps. 

Thanks! These are extremely useful. I looked around for info on that file a while ago but picked up diddly. 


I am guessing that you are talking about the SysFS file. Here is one more thread that can perhaps help: 


Leave a Comment

Please sign in to add a comment. Not a member? Join today