From 7d757483a0db4384117ab4c412a0db4065696103 Mon Sep 17 00:00:00 2001 From: epriestley Date: Sat, 23 May 2015 05:36:02 -0700 Subject: [PATCH] Make everything 1000x or 1000000x slower Summary: In the great `pht()` conversion, some strings like "123,456" are now being printed as numbers with "%d". These come out as "123" instead of "123,456". Use "%s" and "PhutilNumber" to present numbers with comma groupings. Test Plan: - Viewed DarkConsole. - Viewed conduit logs. - Viewed daemon logs. - Grepped for `%d ms` and `%d us`. Reviewers: btrahan, joshuaspence Reviewed By: joshuaspence Subscribers: epriestley Differential Revision: https://secure.phabricator.com/D12979 --- .../controller/PhabricatorConduitLogController.php | 2 +- .../console/plugin/DarkConsoleServicesPlugin.php | 8 +++++--- .../controller/PhabricatorDaemonConsoleController.php | 2 +- .../controller/PhabricatorWorkerTaskDetailController.php | 2 +- .../herald/query/HeraldTranscriptSearchEngine.php | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/applications/conduit/controller/PhabricatorConduitLogController.php b/src/applications/conduit/controller/PhabricatorConduitLogController.php index 2effa1815b..62f3a24905 100644 --- a/src/applications/conduit/controller/PhabricatorConduitLogController.php +++ b/src/applications/conduit/controller/PhabricatorConduitLogController.php @@ -98,7 +98,7 @@ final class PhabricatorConduitLogController array($call->getMethod(), $client), $status, $call->getError(), - pht('%d us', number_format($call->getDuration())), + pht('%s us', new PhutilNumber($call->getDuration())), phabricator_datetime($call->getDateCreated(), $viewer), ); } diff --git a/src/applications/console/plugin/DarkConsoleServicesPlugin.php b/src/applications/console/plugin/DarkConsoleServicesPlugin.php index 6a59c7e129..055315d641 100644 --- a/src/applications/console/plugin/DarkConsoleServicesPlugin.php +++ b/src/applications/console/plugin/DarkConsoleServicesPlugin.php @@ -198,7 +198,7 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { $summary[] = array( $type, number_format($counts[$type]), - pht('%d us', number_format((int)(1000000 * $totals[$type]))), + pht('%s us', new PhutilNumber((int)(1000000 * $totals[$type]))), sprintf('%.1f%%', 100 * $totals[$type] / $page_total), ); } @@ -258,10 +258,12 @@ final class DarkConsoleServicesPlugin extends DarkConsolePlugin { break; } + $offset = ($row['begin'] - $data['start']); + $rows[] = array( $row['type'], - pht('+%d ms', number_format(1000 * ($row['begin'] - $data['start']))), - pht('%d us', number_format(1000000 * $row['duration'])), + pht('+%s ms', new PhutilNumber(1000 * $offset)), + pht('%s us', new PhutilNumber(1000000 * $row['duration'])), $info, $analysis, ); diff --git a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php index 76d98bda5c..921921942c 100644 --- a/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php +++ b/src/applications/daemon/controller/PhabricatorDaemonConsoleController.php @@ -50,7 +50,7 @@ final class PhabricatorDaemonConsoleController $rows[] = array( $class, number_format($info['n']), - pht('%d us', number_format((int)($info['duration'] / $info['n']))), + pht('%s us', new PhutilNumber((int)($info['duration'] / $info['n']))), ); } diff --git a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php index 57951ccb91..66925ffd36 100644 --- a/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php +++ b/src/applications/daemon/controller/PhabricatorWorkerTaskDetailController.php @@ -141,7 +141,7 @@ final class PhabricatorWorkerTaskDetailController $expires); if ($task->isArchived()) { - $duration = pht('%d us', number_format($task->getDuration())); + $duration = pht('%s us', new PhutilNumber($task->getDuration())); } else { $duration = phutil_tag('em', array(), pht('Not Completed')); } diff --git a/src/applications/herald/query/HeraldTranscriptSearchEngine.php b/src/applications/herald/query/HeraldTranscriptSearchEngine.php index 1fd01c3e0d..f9433e0c02 100644 --- a/src/applications/herald/query/HeraldTranscriptSearchEngine.php +++ b/src/applications/herald/query/HeraldTranscriptSearchEngine.php @@ -125,7 +125,7 @@ final class HeraldTranscriptSearchEngine } $item->addAttribute($handles[$xscript->getObjectPHID()]->renderLink()); $item->addAttribute( - pht('%d ms', number_format((int)(1000 * $xscript->getDuration())))); + pht('%s ms', new PhutilNumber((int)(1000 * $xscript->getDuration())))); $item->addIcon( 'none', phabricator_datetime($xscript->getTime(), $viewer));