Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/ui/UIUtils.js

Issue 2288853002: DevTools: Show small times in microseconds (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. 3 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 4 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
5 * Copyright (C) 2009 Joseph Pecoraro 5 * Copyright (C) 2009 Joseph Pecoraro
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 10 *
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 * @return {string} 579 * @return {string}
580 */ 580 */
581 Number.preciseMillisToString = function(ms, precision) 581 Number.preciseMillisToString = function(ms, precision)
582 { 582 {
583 precision = precision || 0; 583 precision = precision || 0;
584 var format = "%." + precision + "f\u2009ms"; 584 var format = "%." + precision + "f\u2009ms";
585 return WebInspector.UIString(format, ms); 585 return WebInspector.UIString(format, ms);
586 } 586 }
587 587
588 /** @type {!WebInspector.UIStringFormat} */ 588 /** @type {!WebInspector.UIStringFormat} */
589 WebInspector._microsFormat = new WebInspector.UIStringFormat("%.0f\u2009\u03bcs" );
590
591 /** @type {!WebInspector.UIStringFormat} */
589 WebInspector._subMillisFormat = new WebInspector.UIStringFormat("%.2f\u2009ms"); 592 WebInspector._subMillisFormat = new WebInspector.UIStringFormat("%.2f\u2009ms");
590 593
591 /** @type {!WebInspector.UIStringFormat} */ 594 /** @type {!WebInspector.UIStringFormat} */
592 WebInspector._millisFormat = new WebInspector.UIStringFormat("%.0f\u2009ms"); 595 WebInspector._millisFormat = new WebInspector.UIStringFormat("%.0f\u2009ms");
593 596
594 /** @type {!WebInspector.UIStringFormat} */ 597 /** @type {!WebInspector.UIStringFormat} */
595 WebInspector._secondsFormat = new WebInspector.UIStringFormat("%.2f\u2009s"); 598 WebInspector._secondsFormat = new WebInspector.UIStringFormat("%.2f\u2009s");
596 599
597 /** @type {!WebInspector.UIStringFormat} */ 600 /** @type {!WebInspector.UIStringFormat} */
598 WebInspector._minutesFormat = new WebInspector.UIStringFormat("%.1f\u2009min"); 601 WebInspector._minutesFormat = new WebInspector.UIStringFormat("%.1f\u2009min");
(...skipping 10 matching lines...) Expand all
609 * @return {string} 612 * @return {string}
610 */ 613 */
611 Number.millisToString = function(ms, higherResolution) 614 Number.millisToString = function(ms, higherResolution)
612 { 615 {
613 if (!isFinite(ms)) 616 if (!isFinite(ms))
614 return "-"; 617 return "-";
615 618
616 if (ms === 0) 619 if (ms === 0)
617 return "0"; 620 return "0";
618 621
622 if (higherResolution && ms < 0.1)
623 return WebInspector._microsFormat.format(ms * 1000);
619 if (higherResolution && ms < 1000) 624 if (higherResolution && ms < 1000)
620 return WebInspector._subMillisFormat.format(ms); 625 return WebInspector._subMillisFormat.format(ms);
621 else if (ms < 1000) 626 if (ms < 1000)
622 return WebInspector._millisFormat.format(ms); 627 return WebInspector._millisFormat.format(ms);
623 628
624 var seconds = ms / 1000; 629 var seconds = ms / 1000;
625 if (seconds < 60) 630 if (seconds < 60)
626 return WebInspector._secondsFormat.format(seconds); 631 return WebInspector._secondsFormat.format(seconds);
627 632
628 var minutes = seconds / 60; 633 var minutes = seconds / 60;
629 if (minutes < 60) 634 if (minutes < 60)
630 return WebInspector._minutesFormat.format(minutes); 635 return WebInspector._minutesFormat.format(minutes);
631 636
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
2006 * @param {string} title 2011 * @param {string} title
2007 * @return {!Element} 2012 * @return {!Element}
2008 */ 2013 */
2009 WebInspector.linkifyDocumentationURLAsNode = function(article, title) 2014 WebInspector.linkifyDocumentationURLAsNode = function(article, title)
2010 { 2015 {
2011 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true); 2016 return WebInspector.linkifyURLAsNode("https://developers.google.com/web/tool s/chrome-devtools/" + article, title, undefined, true);
2012 } 2017 }
2013 2018
2014 /** @type {!WebInspector.ThemeSupport} */ 2019 /** @type {!WebInspector.ThemeSupport} */
2015 WebInspector.themeSupport; 2020 WebInspector.themeSupport;
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698