зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1340928 (part 8) - Pass gStartTime to DuplicateLastSample(). r=mstange.
This removes the one use of gStartTime outside of platform*.cpp, which lets us restrict its visibility to just that compilation unit. --HG-- extra : rebase_source : bf7207572cba5c1a31b544ea73e783ecd559978a
This commit is contained in:
Родитель
45a8d3ea6a
Коммит
d60b476a02
|
@ -12,7 +12,8 @@
|
|||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/RefCounted.h"
|
||||
|
||||
class ProfileBuffer : public mozilla::RefCounted<ProfileBuffer> {
|
||||
class ProfileBuffer : public mozilla::RefCounted<ProfileBuffer>
|
||||
{
|
||||
public:
|
||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ProfileBuffer)
|
||||
|
||||
|
@ -25,7 +26,7 @@ public:
|
|||
JSContext* cx, UniqueStacks& aUniqueStacks);
|
||||
void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
|
||||
UniqueStacks& aUniqueStacks);
|
||||
void DuplicateLastSample(int aThreadId);
|
||||
void DuplicateLastSample(int aThreadId, const mozilla::TimeStamp& aStartTime);
|
||||
|
||||
void addStoredMarker(ProfilerMarker* aStoredMarker);
|
||||
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
// Self
|
||||
#include "ProfileEntry.h"
|
||||
|
||||
using mozilla::MakeUnique;
|
||||
using mozilla::UniquePtr;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::Some;
|
||||
using mozilla::Nothing;
|
||||
using mozilla::JSONWriter;
|
||||
|
||||
using mozilla::MakeUnique;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::Nothing;
|
||||
using mozilla::Some;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::UniquePtr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
// BEGIN ProfileEntry
|
||||
|
@ -754,7 +754,8 @@ int ProfileBuffer::FindLastSampleOfThread(int aThreadId)
|
|||
return -1;
|
||||
}
|
||||
|
||||
void ProfileBuffer::DuplicateLastSample(int aThreadId)
|
||||
void
|
||||
ProfileBuffer::DuplicateLastSample(int aThreadId, const TimeStamp& aStartTime)
|
||||
{
|
||||
int lastSampleStartPos = FindLastSampleOfThread(aThreadId);
|
||||
if (lastSampleStartPos == -1) {
|
||||
|
@ -775,7 +776,7 @@ void ProfileBuffer::DuplicateLastSample(int aThreadId)
|
|||
return;
|
||||
case ProfileEntry::Kind::Time:
|
||||
// Copy with new time
|
||||
addTag(ProfileEntry::Time((mozilla::TimeStamp::Now() - gStartTime).ToMilliseconds()));
|
||||
addTag(ProfileEntry::Time((TimeStamp::Now() - aStartTime).ToMilliseconds()));
|
||||
break;
|
||||
case ProfileEntry::Kind::Marker:
|
||||
// Don't copy markers
|
||||
|
|
|
@ -256,9 +256,9 @@ ThreadInfo::GetMutex()
|
|||
}
|
||||
|
||||
void
|
||||
ThreadInfo::DuplicateLastSample()
|
||||
ThreadInfo::DuplicateLastSample(const TimeStamp& aStartTime)
|
||||
{
|
||||
mBuffer->DuplicateLastSample(mThreadId);
|
||||
mBuffer->DuplicateLastSample(mThreadId, aStartTime);
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
void BeginUnwind();
|
||||
virtual void EndUnwind();
|
||||
|
||||
void DuplicateLastSample();
|
||||
void DuplicateLastSample(const mozilla::TimeStamp& aStartTime);
|
||||
|
||||
ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
|
||||
|
||||
|
|
|
@ -286,7 +286,7 @@ SigprofSender(void* aArg)
|
|||
}
|
||||
|
||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||
info->DuplicateLastSample();
|
||||
info->DuplicateLastSample(gStartTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,7 +164,7 @@ public:
|
|||
}
|
||||
|
||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||
info->DuplicateLastSample();
|
||||
info->DuplicateLastSample(gStartTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class SamplerThread
|
|||
}
|
||||
|
||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||
info->DuplicateLastSample();
|
||||
info->DuplicateLastSample(gStartTime);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,7 @@ bool stack_key_initialized;
|
|||
// XXX: This is set by profiler_init() and profiler_start() on the main thread.
|
||||
// It is read off the main thread, e.g. by Tick(). It might require more
|
||||
// inter-thread synchronization than it currently has.
|
||||
mozilla::TimeStamp gStartTime;
|
||||
static mozilla::TimeStamp gStartTime;
|
||||
|
||||
// XXX: These are accessed by multiple threads and might require more
|
||||
// inter-thread synchronization than they currently have.
|
||||
|
|
|
@ -93,8 +93,6 @@ bool profiler_verbose();
|
|||
#define PROFILE_JAVA
|
||||
#endif
|
||||
|
||||
extern mozilla::TimeStamp gStartTime;
|
||||
|
||||
typedef uint8_t* Address;
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
Загрузка…
Ссылка в новой задаче