Commit a1ccea0c authored by thomasl's avatar thomasl

fix compilation warning and printf of char % not correct (should be %%)


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6038 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 83a4bde6
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/ *******************************************************************************/
#include <stdio.h> #include <stdio.h>
#include "time_meas.h" #include "time_meas.h"
#include <math.h> #include <math.h>
...@@ -34,15 +34,15 @@ ...@@ -34,15 +34,15 @@
// global var for openair performance profiler // global var for openair performance profiler
int opp_enabled = 0; int opp_enabled = 0;
/* /*
double get_cpu_freq_GHz(void) { double get_cpu_freq_GHz(void) {
time_stats_t ts; time_stats_t ts;
reset_meas(&ts); reset_meas(&ts);
start_meas(&ts); start_meas(&ts);
sleep(1); sleep(1);
stop_meas(&ts); stop_meas(&ts);
return (double)ts.diff/1000000000; return (double)ts.diff/1000000000;
}*/ }*/
void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time){ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_time, time_stats_t * sf_exec_time){
...@@ -55,13 +55,13 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti ...@@ -55,13 +55,13 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
cpu_freq_GHz = get_cpu_freq_GHz(); cpu_freq_GHz = get_cpu_freq_GHz();
if (first_time == 0) { if (first_time == 0) {
first_time=1; first_time=1;
fprintf(stderr, "%25s %25s %25s %20s %15s %6f\n","Name","Total","Average/Frame","Trials","CPU_F_GHz", cpu_freq_GHz); fprintf(stderr, "%25s %25s %25s %20s %15s %6f\n","Name","Total","Average/Frame","Trials","CPU_F_GHz", cpu_freq_GHz);
} }
if (ts->trials>0) { if (ts->trials>0) {
//printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials); //printf("%20s: total: %10.3f ms, average: %10.3f us (%10d trials)\n", name, ts->diff/cpu_freq_GHz/1000000.0, ts->diff/ts->trials/cpu_freq_GHz/1000.0, ts->trials);
fprintf(stderr, "%25s: %15.3f ms (%5.2f%); %15.3f us (%5.2f%); %15d;\n", fprintf(stderr, "%25s: %15.3f ms (%5.2f%%); %15.3f us (%5.2f%%); %15d;\n",
name, name,
(ts->diff/cpu_freq_GHz/1000000.0), (ts->diff/cpu_freq_GHz/1000000.0),
((ts->diff/cpu_freq_GHz/1000000.0)/(total_exec_time->diff/cpu_freq_GHz/1000000.0))*100, // percentage ((ts->diff/cpu_freq_GHz/1000000.0)/(total_exec_time->diff/cpu_freq_GHz/1000000.0))*100, // percentage
...@@ -75,12 +75,12 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti ...@@ -75,12 +75,12 @@ void print_meas(time_stats_t *ts, const char* name, time_stats_t * total_exec_ti
double get_time_meas_us(time_stats_t *ts){ double get_time_meas_us(time_stats_t *ts){
static double cpu_freq_GHz = 0.0; static double cpu_freq_GHz = 0.0;
if (cpu_freq_GHz == 0.0) if (cpu_freq_GHz == 0.0)
cpu_freq_GHz = get_cpu_freq_GHz(); cpu_freq_GHz = get_cpu_freq_GHz();
if (ts->trials>0) if (ts->trials>0)
return (ts->diff/ts->trials/cpu_freq_GHz/1000.0); return (ts->diff/ts->trials/cpu_freq_GHz/1000.0);
return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment