@@ -1984,6 +1984,7 @@ void help(void)
19841984 " -c, --cpu cpu-set limit output to summary plus cpu-set:\n"
19851985 " {core | package | j,k,l..m,n-p }\n"
19861986 " -d, --debug displays usec, Time_Of_Day_Seconds and more debugging\n"
1987+ " debug messages are printed to stderr\n"
19871988 " -D, --Dump displays the raw counter values\n"
19881989 " -e, --enable [all | column]\n"
19891990 " shows all or the specified disabled column\n"
@@ -8262,7 +8263,7 @@ int added_perf_counters_init_(struct perf_counter_info *pinfo)
82628263 pinfo -> scale = perf_scale ;
82638264
82648265 if (debug )
8265- printf ( "Add perf/%s/%s cpu%d: %d\n" ,
8266+ fprintf ( stderr , "Add perf/%s/%s cpu%d: %d\n" ,
82668267 pinfo -> device , pinfo -> event , cpu , pinfo -> fd_perf_per_domain [next_domain ]);
82678268 }
82688269
@@ -8422,7 +8423,7 @@ struct msr_counter *find_msrp_by_name(struct msr_counter *head, char *name)
84228423
84238424 for (mp = head ; mp ; mp = mp -> next ) {
84248425 if (debug )
8425- printf ( "%s: %s %s\n" , __func__ , name , mp -> name );
8426+ fprintf ( stderr , "%s: %s %s\n" , __func__ , name , mp -> name );
84268427 if (!strncmp (name , mp -> name , strlen (mp -> name )))
84278428 return mp ;
84288429 }
@@ -8439,16 +8440,16 @@ int add_counter(unsigned int msr_num, char *path, char *name,
84398440 errx (1 , "Requested MSR counter 0x%x, but in --no-msr mode" , msr_num );
84408441
84418442 if (debug )
8442- printf ( "%s(msr%d, %s, %s, width%d, scope%d, type%d, format%d, flags%x, id%d)\n" , __func__ , msr_num ,
8443- path , name , width , scope , type , format , flags , id );
8443+ fprintf ( stderr , "%s(msr%d, %s, %s, width%d, scope%d, type%d, format%d, flags%x, id%d)\n" ,
8444+ __func__ , msr_num , path , name , width , scope , type , format , flags , id );
84448445
84458446 switch (scope ) {
84468447
84478448 case SCOPE_CPU :
84488449 msrp = find_msrp_by_name (sys .tp , name );
84498450 if (msrp ) {
84508451 if (debug )
8451- printf ( "%s: %s FOUND\n" , __func__ , name );
8452+ fprintf ( stderr , "%s: %s FOUND\n" , __func__ , name );
84528453 break ;
84538454 }
84548455 if (sys .added_thread_counters ++ >= MAX_ADDED_THREAD_COUNTERS ) {
@@ -8460,7 +8461,7 @@ int add_counter(unsigned int msr_num, char *path, char *name,
84608461 msrp = find_msrp_by_name (sys .cp , name );
84618462 if (msrp ) {
84628463 if (debug )
8463- printf ( "%s: %s FOUND\n" , __func__ , name );
8464+ fprintf ( stderr , "%s: %s FOUND\n" , __func__ , name );
84648465 break ;
84658466 }
84668467 if (sys .added_core_counters ++ >= MAX_ADDED_CORE_COUNTERS ) {
@@ -8472,7 +8473,7 @@ int add_counter(unsigned int msr_num, char *path, char *name,
84728473 msrp = find_msrp_by_name (sys .pp , name );
84738474 if (msrp ) {
84748475 if (debug )
8475- printf ( "%s: %s FOUND\n" , __func__ , name );
8476+ fprintf ( stderr , "%s: %s FOUND\n" , __func__ , name );
84768477 break ;
84778478 }
84788479 if (sys .added_package_counters ++ >= MAX_ADDED_PACKAGE_COUNTERS ) {
@@ -8617,7 +8618,7 @@ int add_perf_counter(const char *perf_device, const char *perf_event, const char
86178618
86188619 // FIXME: we might not have debug here yet
86198620 if (debug )
8620- printf ( "%s: %s/%s, name: %s, scope%d\n" ,
8621+ fprintf ( stderr , "%s: %s/%s, name: %s, scope%d\n" ,
86218622 __func__ , pinfo -> device , pinfo -> event , pinfo -> name , pinfo -> scope );
86228623
86238624 return 0 ;
0 commit comments