@ -206,27 +206,38 @@ static std::vector<std::string>
parse_benchmark_percentiles ( const char * str )
{
std : : vector < std : : string > percentiles ;
std : : stringstream percent S trings( str ) ;
std : : stringstream percent _s trings( str ) ;
std : : string value ;
size_t maxLength = 0 ; // for padding later on
while ( std : : getline ( percentStrings , value , ' + ' ) ) {
while ( std : : getline ( percent_strings , value , ' + ' ) ) {
trim ( value ) ;
// everything except AVG is assumed to be a percentile.
if ( value ! = " AVG " )
value + = ' % ' ;
if ( value = = " AVG " ) {
percentiles . push_back ( value ) ;
continue ;
}
percentiles . push_back ( value ) ;
float as_float ;
size_t float_len = 0 ;
if ( value . length ( ) > maxLength )
maxLength = value . length ( ) ;
}
try {
as_float = parse_float ( value , & float_len ) ;
} catch ( const std : : invalid_argument & ) {
std : : cerr < < " MANGOHUD: invalid benchmark percentile: ' " < < value < < " ' \n " ;
continue ;
}
// now reiterate over the strings and add equal padding
for ( size_t i = 0 ; i < percentiles . size ( ) ; i + + ) {
percentiles [ i ] . append ( maxLength - percentiles [ i ] . length ( ) , ' ' ) ;
if ( float_len ! = value . length ( ) ) {
std : : cerr < < " MANGOHUD: invalid benchmark percentile: ' " < < value < < " ' \n " ;
continue ;
}
if ( as_float > 100 | | as_float < 0 ) {
std : : cerr < < " MANGOHUD: benchmark percentile is not between 0 and 100 ( " < < value < < " ) \n " ;
continue ;
}
percentiles . push_back ( value ) ;
}
return percentiles ;
@ -423,7 +434,7 @@ parse_overlay_config(struct overlay_params *params,
params - > log_interval = 100 ;
params - > media_player_order = { MP_ORDER_TITLE , MP_ORDER_ARTIST , MP_ORDER_ALBUM } ;
params - > permit_upload = 0 ;
params - > benchmark_percentiles = { " 97 % " , " AVG " , " 1 % " , " 0.1 % " } ;
params - > benchmark_percentiles = { " 97 " , " AVG " , " 1 " , " 0.1 " } ;
# ifdef HAVE_X11
params - > toggle_hud = { XK_Shift_R , XK_F12 } ;