c - Performance of System() -
After the
function in C, for the system (), it affects the hardware counters, so how do you order that The example displayed for the example you are trying to view lets the IM use the display API (PAPI) and the program is a precompiled matrix multiplication application.
PAPI_start_counters (); System ("./matmul"); PAPI_read_counters (); // Print the values PAPI_stop_counters (); I'm clearly missing a bit, but I'm trying to figure out what it is possible to say, counter receiving a program im running Is through use. With my tests I will get wild numbers like below, they are clearly wrong, just want to find out why
total bicycle =========== 140733358872510 instructions complete =========== 4203968 Floating Point Instructions =========== Floating Point Operations =========== 4,196,867 Weight ======= ==== 140733358872804 store ======= ==== 4204037 branches taken =========== 15774436
System () Normally it is a very slow function, on Linux, it is / bin / sh (forking and execution of a full shell process), which parses your order, and spans the other program. To load both of these programs the code needs to load memory, launch all of its libraries, execute startup code, etc. Only then will the program code actually be implemented. Due to the uncertainty of disk access and linux process scheduling, the time in the system () call has a lot of inherent variability, therefore, you will not get accurate results, even if you have high- Use display counter. The better solution will be to compile the target program as a library. Load your counters before initializing them, then perform the main function from the library. In this way, all the codes in your code are executed, and you have a lot of startup time. Your display number will be more precise this way.
Comments
Post a Comment