RESOLVED FIXED167515
Round CPU Usage diagnostic logging to 2 significant digits
https://bugs.webkit.org/show_bug.cgi?id=167515
Summary Round CPU Usage diagnostic logging to 2 significant digits
Chris Dumez
Reported 2017-01-27 10:31:14 PST
Round CPU Usage diagnostic logging to 2 significant digits.
Attachments
Patch (2.75 KB, patch)
2017-01-27 11:00 PST, Chris Dumez
no flags
Chris Dumez
Comment 1 2017-01-27 10:31:37 PST
Chris Dumez
Comment 2 2017-01-27 11:00:38 PST
Antti Koivisto
Comment 3 2017-01-27 11:49:20 PST
Comment on attachment 299943 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299943&action=review > Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp:80 > +static String toStringRoundingSignificantFigures(double value, unsigned significantFigures) > +{ > + DecimalNumber decimal(value, RoundingSignificantFigures, significantFigures); > + NumberToLStringBuffer buffer; > + unsigned length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength); > + return String(buffer, length); > +} Is this somehow better than String::number(cpuUsage, 2)?
Chris Dumez
Comment 4 2017-01-27 12:09:19 PST
Comment on attachment 299943 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=299943&action=review >> Source/WebKit2/UIProcess/PerActivityStateCPUUsageSampler.cpp:80 >> +} > > Is this somehow better than String::number(cpuUsage, 2)? String::number() takes a number of "decimal digits". I really need a number of "significant figures". 10 has 1 significant figure. 10.2 has 3 significant figures.
WebKit Commit Bot
Comment 5 2017-01-27 12:34:32 PST
Comment on attachment 299943 [details] Patch Clearing flags on attachment: 299943 Committed r211295: <http://trac.webkit.org/changeset/211295>
WebKit Commit Bot
Comment 6 2017-01-27 12:34:37 PST
All reviewed patches have been landed. Closing bug.
Antti Koivisto
Comment 7 2017-01-27 15:22:06 PST
> I really need a number > of "significant figures". 10 has 1 significant figure. 10.2 has 3 > significant figures. I thought that is what String::number() with precision argument does.
Chris Dumez
Comment 8 2017-01-27 15:34:33 PST
(In reply to comment #7) > > I really need a number > > of "significant figures". 10 has 1 significant figure. 10.2 has 3 > > significant figures. > > I thought that is what String::number() with precision argument does. Oh, I'll double check then. Using String::number() would be nicer indeed if it does what I want.
Note You need to log in before you can comment on or make changes to this bug.