@@ -195,12 +195,14 @@ static struct hist_entry_ops c2c_entry_ops = {
195
195
196
196
static int c2c_hists__init (struct c2c_hists * hists ,
197
197
const char * sort ,
198
- int nr_header_lines );
198
+ int nr_header_lines ,
199
+ struct perf_env * env );
199
200
200
201
static struct c2c_hists *
201
202
he__get_c2c_hists (struct hist_entry * he ,
202
203
const char * sort ,
203
- int nr_header_lines )
204
+ int nr_header_lines ,
205
+ struct perf_env * env )
204
206
{
205
207
struct c2c_hist_entry * c2c_he ;
206
208
struct c2c_hists * hists ;
@@ -214,7 +216,7 @@ he__get_c2c_hists(struct hist_entry *he,
214
216
if (!hists )
215
217
return NULL ;
216
218
217
- ret = c2c_hists__init (hists , sort , nr_header_lines );
219
+ ret = c2c_hists__init (hists , sort , nr_header_lines , env );
218
220
if (ret ) {
219
221
free (hists );
220
222
return NULL ;
@@ -350,7 +352,7 @@ static int process_sample_event(const struct perf_tool *tool __maybe_unused,
350
352
351
353
mi = mi_dup ;
352
354
353
- c2c_hists = he__get_c2c_hists (he , c2c .cl_sort , 2 );
355
+ c2c_hists = he__get_c2c_hists (he , c2c .cl_sort , 2 , machine -> env );
354
356
if (!c2c_hists )
355
357
goto free_mi ;
356
358
@@ -1966,7 +1968,8 @@ static struct c2c_fmt *get_format(const char *name)
1966
1968
return c2c_fmt ;
1967
1969
}
1968
1970
1969
- static int c2c_hists__init_output (struct perf_hpp_list * hpp_list , char * name )
1971
+ static int c2c_hists__init_output (struct perf_hpp_list * hpp_list , char * name ,
1972
+ struct perf_env * env __maybe_unused )
1970
1973
{
1971
1974
struct c2c_fmt * c2c_fmt = get_format (name );
1972
1975
int level = 0 ;
@@ -1980,14 +1983,14 @@ static int c2c_hists__init_output(struct perf_hpp_list *hpp_list, char *name)
1980
1983
return 0 ;
1981
1984
}
1982
1985
1983
- static int c2c_hists__init_sort (struct perf_hpp_list * hpp_list , char * name )
1986
+ static int c2c_hists__init_sort (struct perf_hpp_list * hpp_list , char * name , struct perf_env * env )
1984
1987
{
1985
1988
struct c2c_fmt * c2c_fmt = get_format (name );
1986
1989
struct c2c_dimension * dim ;
1987
1990
1988
1991
if (!c2c_fmt ) {
1989
1992
reset_dimensions ();
1990
- return sort_dimension__add (hpp_list , name , NULL , 0 );
1993
+ return sort_dimension__add (hpp_list , name , /*evlist=*/ NULL , env , /*level=*/ 0 );
1991
1994
}
1992
1995
1993
1996
dim = c2c_fmt -> dim ;
@@ -2008,7 +2011,7 @@ static int c2c_hists__init_sort(struct perf_hpp_list *hpp_list, char *name)
2008
2011
\
2009
2012
for (tok = strtok_r((char *)_list, ", ", &tmp); \
2010
2013
tok; tok = strtok_r(NULL, ", ", &tmp)) { \
2011
- ret = _fn(hpp_list, tok); \
2014
+ ret = _fn(hpp_list, tok, env ); \
2012
2015
if (ret == -EINVAL) { \
2013
2016
pr_err("Invalid --fields key: `%s'", tok); \
2014
2017
break; \
@@ -2021,7 +2024,8 @@ static int c2c_hists__init_sort(struct perf_hpp_list *hpp_list, char *name)
2021
2024
2022
2025
static int hpp_list__parse (struct perf_hpp_list * hpp_list ,
2023
2026
const char * output_ ,
2024
- const char * sort_ )
2027
+ const char * sort_ ,
2028
+ struct perf_env * env )
2025
2029
{
2026
2030
char * output = output_ ? strdup (output_ ) : NULL ;
2027
2031
char * sort = sort_ ? strdup (sort_ ) : NULL ;
@@ -2052,7 +2056,8 @@ static int hpp_list__parse(struct perf_hpp_list *hpp_list,
2052
2056
2053
2057
static int c2c_hists__init (struct c2c_hists * hists ,
2054
2058
const char * sort ,
2055
- int nr_header_lines )
2059
+ int nr_header_lines ,
2060
+ struct perf_env * env )
2056
2061
{
2057
2062
__hists__init (& hists -> hists , & hists -> list );
2058
2063
@@ -2066,15 +2071,16 @@ static int c2c_hists__init(struct c2c_hists *hists,
2066
2071
/* Overload number of header lines.*/
2067
2072
hists -> list .nr_header_lines = nr_header_lines ;
2068
2073
2069
- return hpp_list__parse (& hists -> list , NULL , sort );
2074
+ return hpp_list__parse (& hists -> list , /*output=*/ NULL , sort , env );
2070
2075
}
2071
2076
2072
2077
static int c2c_hists__reinit (struct c2c_hists * c2c_hists ,
2073
2078
const char * output ,
2074
- const char * sort )
2079
+ const char * sort ,
2080
+ struct perf_env * env )
2075
2081
{
2076
2082
perf_hpp__reset_output_field (& c2c_hists -> list );
2077
- return hpp_list__parse (& c2c_hists -> list , output , sort );
2083
+ return hpp_list__parse (& c2c_hists -> list , output , sort , env );
2078
2084
}
2079
2085
2080
2086
#define DISPLAY_LINE_LIMIT 0.001
@@ -2207,8 +2213,9 @@ static int filter_cb(struct hist_entry *he, void *arg __maybe_unused)
2207
2213
return 0 ;
2208
2214
}
2209
2215
2210
- static int resort_cl_cb (struct hist_entry * he , void * arg __maybe_unused )
2216
+ static int resort_cl_cb (struct hist_entry * he , void * arg )
2211
2217
{
2218
+ struct perf_env * env = arg ;
2212
2219
struct c2c_hist_entry * c2c_he ;
2213
2220
struct c2c_hists * c2c_hists ;
2214
2221
bool display = he__display (he , & c2c .shared_clines_stats );
@@ -2222,7 +2229,7 @@ static int resort_cl_cb(struct hist_entry *he, void *arg __maybe_unused)
2222
2229
c2c_he -> cacheline_idx = idx ++ ;
2223
2230
calc_width (c2c_he );
2224
2231
2225
- c2c_hists__reinit (c2c_hists , c2c .cl_output , c2c .cl_resort );
2232
+ c2c_hists__reinit (c2c_hists , c2c .cl_output , c2c .cl_resort , env );
2226
2233
2227
2234
hists__collapse_resort (& c2c_hists -> hists , NULL );
2228
2235
hists__output_resort_cb (& c2c_hists -> hists , NULL , filter_cb );
@@ -2334,7 +2341,7 @@ static int resort_shared_cl_cb(struct hist_entry *he, void *arg __maybe_unused)
2334
2341
return 0 ;
2335
2342
}
2336
2343
2337
- static int hists__iterate_cb (struct hists * hists , hists__resort_cb_t cb )
2344
+ static int hists__iterate_cb (struct hists * hists , hists__resort_cb_t cb , void * arg )
2338
2345
{
2339
2346
struct rb_node * next = rb_first_cached (& hists -> entries );
2340
2347
int ret = 0 ;
@@ -2343,7 +2350,7 @@ static int hists__iterate_cb(struct hists *hists, hists__resort_cb_t cb)
2343
2350
struct hist_entry * he ;
2344
2351
2345
2352
he = rb_entry (next , struct hist_entry , rb_node );
2346
- ret = cb (he , NULL );
2353
+ ret = cb (he , arg );
2347
2354
if (ret )
2348
2355
break ;
2349
2356
next = rb_next (& he -> rb_node );
@@ -2449,7 +2456,7 @@ static void print_cacheline(struct c2c_hists *c2c_hists,
2449
2456
hists__fprintf (& c2c_hists -> hists , false, 0 , 0 , 0 , out , false);
2450
2457
}
2451
2458
2452
- static void print_pareto (FILE * out )
2459
+ static void print_pareto (FILE * out , struct perf_env * env )
2453
2460
{
2454
2461
struct perf_hpp_list hpp_list ;
2455
2462
struct rb_node * nd ;
@@ -2474,7 +2481,7 @@ static void print_pareto(FILE *out)
2474
2481
"dcacheline" ;
2475
2482
2476
2483
perf_hpp_list__init (& hpp_list );
2477
- ret = hpp_list__parse (& hpp_list , cl_output , NULL );
2484
+ ret = hpp_list__parse (& hpp_list , cl_output , /*evlist=*/ NULL , env );
2478
2485
2479
2486
if (WARN_ONCE (ret , "failed to setup sort entries\n" ))
2480
2487
return ;
@@ -2539,7 +2546,7 @@ static void perf_c2c__hists_fprintf(FILE *out, struct perf_session *session)
2539
2546
fprintf (out , "=================================================\n" );
2540
2547
fprintf (out , "#\n" );
2541
2548
2542
- print_pareto (out );
2549
+ print_pareto (out , perf_session__env ( session ) );
2543
2550
}
2544
2551
2545
2552
#ifdef HAVE_SLANG_SUPPORT
@@ -3097,7 +3104,7 @@ static int perf_c2c__report(int argc, const char **argv)
3097
3104
goto out_session ;
3098
3105
}
3099
3106
3100
- err = c2c_hists__init (& c2c .hists , "dcacheline" , 2 );
3107
+ err = c2c_hists__init (& c2c .hists , "dcacheline" , 2 , perf_session__env ( session ) );
3101
3108
if (err ) {
3102
3109
pr_debug ("Failed to initialize hists\n" );
3103
3110
goto out_session ;
@@ -3181,13 +3188,13 @@ static int perf_c2c__report(int argc, const char **argv)
3181
3188
else if (c2c .display == DISPLAY_SNP_PEER )
3182
3189
sort_str = "tot_peer" ;
3183
3190
3184
- c2c_hists__reinit (& c2c .hists , output_str , sort_str );
3191
+ c2c_hists__reinit (& c2c .hists , output_str , sort_str , perf_session__env ( session ) );
3185
3192
3186
3193
ui_progress__init (& prog , c2c .hists .hists .nr_entries , "Sorting..." );
3187
3194
3188
3195
hists__collapse_resort (& c2c .hists .hists , NULL );
3189
3196
hists__output_resort_cb (& c2c .hists .hists , & prog , resort_shared_cl_cb );
3190
- hists__iterate_cb (& c2c .hists .hists , resort_cl_cb );
3197
+ hists__iterate_cb (& c2c .hists .hists , resort_cl_cb , perf_session__env ( session ) );
3191
3198
3192
3199
ui_progress__finish ();
3193
3200
0 commit comments