You are here

public static function ReportConstants::percentFormat in XHProf 8

Formats float as percent.

Parameters

float $s: The number.

int $precision: The precision.

Return value

string The formatted number.

File

src/XHProfLib/Report/ReportConstants.php, line 191

Class

ReportConstants
Provides helpers for string constants.

Namespace

Drupal\xhprof\XHProfLib\Report

Code

public static function percentFormat($s, $precision = 1) {
  return sprintf('%.' . $precision . 'f%%', 100 * $s);
}