зеркало из 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/RefPtr.h"
|
||||||
#include "mozilla/RefCounted.h"
|
#include "mozilla/RefCounted.h"
|
||||||
|
|
||||||
class ProfileBuffer : public mozilla::RefCounted<ProfileBuffer> {
|
class ProfileBuffer : public mozilla::RefCounted<ProfileBuffer>
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ProfileBuffer)
|
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(ProfileBuffer)
|
||||||
|
|
||||||
|
@ -25,7 +26,7 @@ public:
|
||||||
JSContext* cx, UniqueStacks& aUniqueStacks);
|
JSContext* cx, UniqueStacks& aUniqueStacks);
|
||||||
void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
|
void StreamMarkersToJSON(SpliceableJSONWriter& aWriter, int aThreadId, double aSinceTime,
|
||||||
UniqueStacks& aUniqueStacks);
|
UniqueStacks& aUniqueStacks);
|
||||||
void DuplicateLastSample(int aThreadId);
|
void DuplicateLastSample(int aThreadId, const mozilla::TimeStamp& aStartTime);
|
||||||
|
|
||||||
void addStoredMarker(ProfilerMarker* aStoredMarker);
|
void addStoredMarker(ProfilerMarker* aStoredMarker);
|
||||||
|
|
||||||
|
|
|
@ -18,13 +18,13 @@
|
||||||
// Self
|
// Self
|
||||||
#include "ProfileEntry.h"
|
#include "ProfileEntry.h"
|
||||||
|
|
||||||
using mozilla::MakeUnique;
|
|
||||||
using mozilla::UniquePtr;
|
|
||||||
using mozilla::Maybe;
|
|
||||||
using mozilla::Some;
|
|
||||||
using mozilla::Nothing;
|
|
||||||
using mozilla::JSONWriter;
|
using mozilla::JSONWriter;
|
||||||
|
using mozilla::MakeUnique;
|
||||||
|
using mozilla::Maybe;
|
||||||
|
using mozilla::Nothing;
|
||||||
|
using mozilla::Some;
|
||||||
|
using mozilla::TimeStamp;
|
||||||
|
using mozilla::UniquePtr;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////
|
||||||
// BEGIN ProfileEntry
|
// BEGIN ProfileEntry
|
||||||
|
@ -754,7 +754,8 @@ int ProfileBuffer::FindLastSampleOfThread(int aThreadId)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProfileBuffer::DuplicateLastSample(int aThreadId)
|
void
|
||||||
|
ProfileBuffer::DuplicateLastSample(int aThreadId, const TimeStamp& aStartTime)
|
||||||
{
|
{
|
||||||
int lastSampleStartPos = FindLastSampleOfThread(aThreadId);
|
int lastSampleStartPos = FindLastSampleOfThread(aThreadId);
|
||||||
if (lastSampleStartPos == -1) {
|
if (lastSampleStartPos == -1) {
|
||||||
|
@ -775,7 +776,7 @@ void ProfileBuffer::DuplicateLastSample(int aThreadId)
|
||||||
return;
|
return;
|
||||||
case ProfileEntry::Kind::Time:
|
case ProfileEntry::Kind::Time:
|
||||||
// Copy with new time
|
// Copy with new time
|
||||||
addTag(ProfileEntry::Time((mozilla::TimeStamp::Now() - gStartTime).ToMilliseconds()));
|
addTag(ProfileEntry::Time((TimeStamp::Now() - aStartTime).ToMilliseconds()));
|
||||||
break;
|
break;
|
||||||
case ProfileEntry::Kind::Marker:
|
case ProfileEntry::Kind::Marker:
|
||||||
// Don't copy markers
|
// Don't copy markers
|
||||||
|
|
|
@ -256,9 +256,9 @@ ThreadInfo::GetMutex()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ThreadInfo::DuplicateLastSample()
|
ThreadInfo::DuplicateLastSample(const TimeStamp& aStartTime)
|
||||||
{
|
{
|
||||||
mBuffer->DuplicateLastSample(mThreadId);
|
mBuffer->DuplicateLastSample(mThreadId, aStartTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t
|
size_t
|
||||||
|
|
|
@ -73,7 +73,7 @@ public:
|
||||||
void BeginUnwind();
|
void BeginUnwind();
|
||||||
virtual void EndUnwind();
|
virtual void EndUnwind();
|
||||||
|
|
||||||
void DuplicateLastSample();
|
void DuplicateLastSample(const mozilla::TimeStamp& aStartTime);
|
||||||
|
|
||||||
ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
|
ThreadResponsiveness* GetThreadResponsiveness() { return &mRespInfo; }
|
||||||
|
|
||||||
|
|
|
@ -286,7 +286,7 @@ SigprofSender(void* aArg)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||||
info->DuplicateLastSample();
|
info->DuplicateLastSample(gStartTime);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -164,7 +164,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||||
info->DuplicateLastSample();
|
info->DuplicateLastSample(gStartTime);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -174,7 +174,7 @@ class SamplerThread
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
if (info->Stack()->CanDuplicateLastSampleDueToSleep()) {
|
||||||
info->DuplicateLastSample();
|
info->DuplicateLastSample(gStartTime);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ bool stack_key_initialized;
|
||||||
// XXX: This is set by profiler_init() and profiler_start() on the main thread.
|
// 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
|
// It is read off the main thread, e.g. by Tick(). It might require more
|
||||||
// inter-thread synchronization than it currently has.
|
// 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
|
// XXX: These are accessed by multiple threads and might require more
|
||||||
// inter-thread synchronization than they currently have.
|
// inter-thread synchronization than they currently have.
|
||||||
|
|
|
@ -93,8 +93,6 @@ bool profiler_verbose();
|
||||||
#define PROFILE_JAVA
|
#define PROFILE_JAVA
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern mozilla::TimeStamp gStartTime;
|
|
||||||
|
|
||||||
typedef uint8_t* Address;
|
typedef uint8_t* Address;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
Загрузка…
Ссылка в новой задаче