From 6b8cc150cfea2341884303e2c5b6a64ecfd90ec7 Mon Sep 17 00:00:00 2001 From: Viktor Stanchev Date: Thu, 10 Apr 2014 10:52:23 -0400 Subject: [PATCH] Bug 962262 - Profiler - Use float instead of double to pack circular buffer. r=benwa --HG-- extra : rebase_source : 62429abbb05c199ed714ecec2f6b000296b94deb --- tools/profiler/BreakpadSampler.cpp | 4 ++-- tools/profiler/ProfileEntry.cpp | 4 ++-- tools/profiler/ProfileEntry.h | 4 ++-- tools/profiler/TableTicker.cpp | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/profiler/BreakpadSampler.cpp b/tools/profiler/BreakpadSampler.cpp index 601df5de273..113401dc91b 100644 --- a/tools/profiler/BreakpadSampler.cpp +++ b/tools/profiler/BreakpadSampler.cpp @@ -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(delta.ToMilliseconds())) ); } if (sample) { TimeDuration delta = sample->timestamp - sStartTime; - utb__addEntry( utb, ProfileEntry('t', delta.ToMilliseconds()) ); + utb__addEntry( utb, ProfileEntry('t', static_cast(delta.ToMilliseconds())) ); } if (sLastFrameNumber != sFrameNumber) { diff --git a/tools/profiler/ProfileEntry.cpp b/tools/profiler/ProfileEntry.cpp index d221aa69243..d696a98de19 100644 --- a/tools/profiler/ProfileEntry.cpp +++ b/tools/profiler/ProfileEntry.cpp @@ -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((mozilla::TimeStamp::Now() - sStartTime).ToMilliseconds()))); break; // Don't copy markers case 'm': diff --git a/tools/profiler/ProfileEntry.h b/tools/profiler/ProfileEntry.h index e866b4368ff..8fdb9d4247a 100644 --- a/tools/profiler/ProfileEntry.h +++ b/tools/profiler/ProfileEntry.h @@ -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; diff --git a/tools/profiler/TableTicker.cpp b/tools/profiler/TableTicker.cpp index 18d74187c9e..9fa038e234d 100644 --- a/tools/profiler/TableTicker.cpp +++ b/tools/profiler/TableTicker.cpp @@ -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(PR_Now()/1000.0 - delta.ToMilliseconds())); nsresult res; nsCOMPtr 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(delta.ToMilliseconds()))); } if (sample) { TimeDuration delta = sample->timestamp - sStartTime; - currThreadProfile.addTag(ProfileEntry('t', delta.ToMilliseconds())); + currThreadProfile.addTag(ProfileEntry('t', static_cast(delta.ToMilliseconds()))); } #if defined(XP_WIN) if (powerSample) { - currThreadProfile.addTag(ProfileEntry('p', mIntelPowerGadget->GetTotalPackagePowerInWatts())); + currThreadProfile.addTag(ProfileEntry('p', static_cast(mIntelPowerGadget->GetTotalPackagePowerInWatts()))); } #endif