Round CPU Usage diagnostic logging to 2 significant digits.
<rdar://problem/30236297>
Created attachment 299943 [details] Patch
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)?
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.
Comment on attachment 299943 [details] Patch Clearing flags on attachment: 299943 Committed r211295: <http://trac.webkit.org/changeset/211295>
All reviewed patches have been landed. Closing bug.
> 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.
(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.