Bug 962262 - Profiler - Use float instead of double to pack circular buffer. r=benwa

--HG--
extra : rebase_source : 62429abbb05c199ed714ecec2f6b000296b94deb
This commit is contained in:
Viktor Stanchev 2014-04-10 10:52:23 -04:00
parent 300558be71
commit 6b8cc150cf
4 changed files with 10 additions and 10 deletions

View File

@ -239,12 +239,12 @@ void populateBuffer(UnwinderThreadBuffer* utb, TickSample* sample,
// Add any extras
if (!sLastTracerEvent.IsNull() && sample) {
TimeDuration delta = sample->timestamp - sLastTracerEvent;
utb__addEntry( utb, ProfileEntry('r', delta.ToMilliseconds()) );
utb__addEntry( utb, ProfileEntry('r', static_cast<float>(delta.ToMilliseconds())) );
}
if (sample) {
TimeDuration delta = sample->timestamp - sStartTime;
utb__addEntry( utb, ProfileEntry('t', delta.ToMilliseconds()) );
utb__addEntry( utb, ProfileEntry('t', static_cast<float>(delta.ToMilliseconds())) );
}
if (sLastFrameNumber != sFrameNumber) {

View File

@ -43,7 +43,7 @@ ProfileEntry::ProfileEntry(char aTagName, void *aTagPtr)
, mTagName(aTagName)
{ }
ProfileEntry::ProfileEntry(char aTagName, double aTagFloat)
ProfileEntry::ProfileEntry(char aTagName, float aTagFloat)
: mTagFloat(aTagFloat)
, mTagName(aTagName)
{ }
@ -473,7 +473,7 @@ void ThreadProfile::DuplicateLastSample() {
switch (mEntries[readPos].mTagName) {
// Copy with new time
case 't':
addTag(ProfileEntry('t', (mozilla::TimeStamp::Now() - sStartTime).ToMilliseconds()));
addTag(ProfileEntry('t', static_cast<float>((mozilla::TimeStamp::Now() - sStartTime).ToMilliseconds())));
break;
// Don't copy markers
case 'm':

View File

@ -26,7 +26,7 @@ public:
ProfileEntry(char aTagName, const char *aTagData);
ProfileEntry(char aTagName, void *aTagPtr);
ProfileEntry(char aTagName, ProfilerMarker *aTagMarker);
ProfileEntry(char aTagName, double aTagFloat);
ProfileEntry(char aTagName, float aTagFloat);
ProfileEntry(char aTagName, uintptr_t aTagOffset);
ProfileEntry(char aTagName, Address aTagAddress);
ProfileEntry(char aTagName, int aTagLine);
@ -51,7 +51,7 @@ private:
char mTagChars[sizeof(void*)];
void* mTagPtr;
ProfilerMarker* mTagMarker;
double mTagFloat;
float mTagFloat;
Address mTagAddress;
uintptr_t mTagOffset;
int mTagLine;

View File

@ -117,7 +117,7 @@ typename Builder::Object TableTicker::GetMetaJSCustomObject(Builder& b)
b.DefineProperty(meta, "processType", XRE_GetProcessType());
TimeDuration delta = TimeStamp::Now() - sStartTime;
b.DefineProperty(meta, "startTime", PR_Now()/1000.0 - delta.ToMilliseconds());
b.DefineProperty(meta, "startTime", static_cast<float>(PR_Now()/1000.0 - delta.ToMilliseconds()));
nsresult res;
nsCOMPtr<nsIHttpProtocolHandler> http = do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &res);
@ -639,17 +639,17 @@ void TableTicker::InplaceTick(TickSample* sample)
if (!sLastTracerEvent.IsNull() && sample && currThreadProfile.IsMainThread()) {
TimeDuration delta = sample->timestamp - sLastTracerEvent;
currThreadProfile.addTag(ProfileEntry('r', delta.ToMilliseconds()));
currThreadProfile.addTag(ProfileEntry('r', static_cast<float>(delta.ToMilliseconds())));
}
if (sample) {
TimeDuration delta = sample->timestamp - sStartTime;
currThreadProfile.addTag(ProfileEntry('t', delta.ToMilliseconds()));
currThreadProfile.addTag(ProfileEntry('t', static_cast<float>(delta.ToMilliseconds())));
}
#if defined(XP_WIN)
if (powerSample) {
currThreadProfile.addTag(ProfileEntry('p', mIntelPowerGadget->GetTotalPackagePowerInWatts()));
currThreadProfile.addTag(ProfileEntry('p', static_cast<float>(mIntelPowerGadget->GetTotalPackagePowerInWatts())));
}
#endif