mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1170534 - Remove Visual Event Tracer. r=dougt
This commit is contained in:
parent
1e37503d48
commit
286d5912dd
11
configure.in
11
configure.in
@ -7433,17 +7433,6 @@ dnl =
|
||||
dnl ========================================================
|
||||
MOZ_ARG_HEADER(Profiling and Instrumenting)
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable runtime visual profiling logger
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(visual-event-tracer,
|
||||
[ --enable-visual-event-tracer Enable visual event tracer instrumentation],
|
||||
MOZ_VISUAL_EVENT_TRACER=1,
|
||||
MOZ_VISUAL_EVENT_TRACER=)
|
||||
if test -n "$MOZ_VISUAL_EVENT_TRACER"; then
|
||||
AC_DEFINE(MOZ_VISUAL_EVENT_TRACER)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable TaskTracer
|
||||
dnl ========================================================
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "mozilla/StartupTimeline.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "URIUtils.h"
|
||||
|
||||
#include "nsIContent.h"
|
||||
@ -7500,8 +7499,6 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(this, "docshell::pageload");
|
||||
|
||||
nsCOMPtr<nsIURI> url;
|
||||
nsresult rv = aChannel->GetURI(getter_AddRefs(url));
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -10482,13 +10479,6 @@ nsDocShell::DoURILoad(nsIURI* aURI,
|
||||
nsIURI* aBaseURI,
|
||||
nsContentPolicyType aContentPolicyType)
|
||||
{
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
nsAutoCString urlSpec;
|
||||
aURI->GetAsciiSpec(urlSpec);
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(this, urlSpec.BeginReading());
|
||||
MOZ_EVENT_TRACER_EXEC(this, "docshell::pageload");
|
||||
#endif
|
||||
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURILoader> uriLoader;
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "NetworkActivityMonitor.h"
|
||||
#include "NSSErrorsService.h"
|
||||
#include "mozilla/net/NeckoChild.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "nsISocketProviderService.h"
|
||||
#include "nsISocketProvider.h"
|
||||
@ -784,8 +783,6 @@ nsSocketTransport::Init(const char **types, uint32_t typeCount,
|
||||
const nsACString &hostRoute, uint16_t portRoute,
|
||||
nsIProxyInfo *givenProxyInfo)
|
||||
{
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(this, host.BeginReading());
|
||||
|
||||
nsCOMPtr<nsProxyInfo> proxyInfo;
|
||||
if (givenProxyInfo) {
|
||||
proxyInfo = do_QueryInterface(givenProxyInfo);
|
||||
@ -1397,7 +1394,6 @@ nsSocketTransport::InitiateSocket()
|
||||
|
||||
NetAddrToPRNetAddr(&mNetAddr, &prAddr);
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(this, "net::tcp::connect");
|
||||
status = PR_Connect(fd, &prAddr, NS_SOCKET_CONNECT_TIMEOUT);
|
||||
if (status == PR_SUCCESS) {
|
||||
//
|
||||
@ -1642,8 +1638,6 @@ nsSocketTransport::OnSocketConnected()
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(this, "net::tcp::connect");
|
||||
|
||||
SendStatus(NS_NET_STATUS_CONNECTED_TO);
|
||||
}
|
||||
|
||||
@ -2444,7 +2438,6 @@ nsSocketTransport::OnLookupComplete(nsICancelable *request,
|
||||
// flag host lookup complete for the benefit of the ResolveHost method.
|
||||
mResolving = false;
|
||||
|
||||
MOZ_EVENT_TRACER_WAIT(this, "net::tcp::connect");
|
||||
nsresult rv = PostEvent(MSG_DNS_LOOKUP_COMPLETE, status, rec);
|
||||
|
||||
// if posting a message fails, then we should assume that the socket
|
||||
|
3
netwerk/cache/nsCacheEntry.cpp
vendored
3
netwerk/cache/nsCacheEntry.cpp
vendored
@ -17,7 +17,6 @@
|
||||
#include "nsCacheService.h"
|
||||
#include "nsCacheDevice.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
@ -45,8 +44,6 @@ nsCacheEntry::nsCacheEntry(const nsACString & key,
|
||||
SetStoragePolicy(storagePolicy);
|
||||
|
||||
MarkPublic();
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(this, key.BeginReading());
|
||||
}
|
||||
|
||||
|
||||
|
42
netwerk/cache/nsCacheService.cpp
vendored
42
netwerk/cache/nsCacheService.cpp
vendored
@ -41,7 +41,6 @@
|
||||
#include "mozIStorageService.h"
|
||||
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
@ -971,8 +970,6 @@ class nsProcessRequestEvent : public nsRunnable {
|
||||
public:
|
||||
explicit nsProcessRequestEvent(nsCacheRequest *aRequest)
|
||||
{
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(aRequest, aRequest->mKey.get());
|
||||
MOZ_EVENT_TRACER_WAIT(aRequest, "net::cache::ProcessRequest");
|
||||
mRequest = aRequest;
|
||||
}
|
||||
|
||||
@ -1139,8 +1136,6 @@ nsCacheService::Init()
|
||||
mStorageService = do_GetService("@mozilla.org/storage/service;1", &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(nsCacheService::gService, "nsCacheService");
|
||||
|
||||
rv = NS_NewNamedThread("Cache I/O",
|
||||
getter_AddRefs(mCacheIOThread));
|
||||
if (NS_FAILED(rv)) {
|
||||
@ -1879,12 +1874,6 @@ public:
|
||||
|
||||
NS_IMETHOD Run()
|
||||
{
|
||||
mozilla::eventtracer::AutoEventTracer tracer(
|
||||
static_cast<nsIRunnable*>(this),
|
||||
eventtracer::eExec,
|
||||
eventtracer::eDone,
|
||||
"net::cache::OnCacheEntryAvailable");
|
||||
|
||||
mListener->OnCacheEntryAvailable(mDescriptor, mAccessGranted, mStatus);
|
||||
|
||||
NS_RELEASE(mListener);
|
||||
@ -1926,8 +1915,6 @@ nsCacheService::NotifyListener(nsCacheRequest * request,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(ev.get(), request->mKey.get());
|
||||
MOZ_EVENT_TRACER_WAIT(ev.get(), "net::cache::OnCacheEntryAvailable");
|
||||
return request->mThread->Dispatch(ev, NS_DISPATCH_NORMAL);
|
||||
}
|
||||
|
||||
@ -1937,12 +1924,6 @@ nsCacheService::ProcessRequest(nsCacheRequest * request,
|
||||
bool calledFromOpenCacheEntry,
|
||||
nsICacheEntryDescriptor ** result)
|
||||
{
|
||||
mozilla::eventtracer::AutoEventTracer tracer(
|
||||
request,
|
||||
eventtracer::eExec,
|
||||
eventtracer::eDone,
|
||||
"net::cache::ProcessRequest");
|
||||
|
||||
// !!! must be called with mLock held !!!
|
||||
nsresult rv;
|
||||
nsCacheEntry * entry = nullptr;
|
||||
@ -2104,12 +2085,6 @@ nsCacheService::ActivateEntry(nsCacheRequest * request,
|
||||
if (!mInitialized || mClearingEntries)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
|
||||
mozilla::eventtracer::AutoEventTracer tracer(
|
||||
request,
|
||||
eventtracer::eExec,
|
||||
eventtracer::eDone,
|
||||
"net::cache::ActivateEntry");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
NS_ASSERTION(request != nullptr, "ActivateEntry called with no request");
|
||||
@ -2211,13 +2186,6 @@ nsCacheService::SearchCacheDevices(nsCString * key, nsCacheStoragePolicy policy,
|
||||
Telemetry::AutoTimer<Telemetry::CACHE_DEVICE_SEARCH_2> timer;
|
||||
nsCacheEntry * entry = nullptr;
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(key, key->BeginReading());
|
||||
eventtracer::AutoEventTracer searchCacheDevices(
|
||||
key,
|
||||
eventtracer::eExec,
|
||||
eventtracer::eDone,
|
||||
"net::cache::SearchCacheDevices");
|
||||
|
||||
CACHE_LOG_DEBUG(("mMemoryDevice: 0x%p\n", mMemoryDevice));
|
||||
|
||||
*collision = false;
|
||||
@ -2686,13 +2654,11 @@ nsCacheService::Lock(mozilla::Telemetry::ID mainThreadLockerID)
|
||||
}
|
||||
|
||||
TimeStamp start(TimeStamp::Now());
|
||||
MOZ_EVENT_TRACER_WAIT(nsCacheService::gService, "net::cache::lock");
|
||||
|
||||
gService->mLock.Lock();
|
||||
gService->LockAcquired();
|
||||
|
||||
TimeStamp stop(TimeStamp::Now());
|
||||
MOZ_EVENT_TRACER_EXEC(nsCacheService::gService, "net::cache::lock");
|
||||
|
||||
// Telemetry isn't thread safe on its own, but this is OK because we're
|
||||
// protecting it with the cache lock.
|
||||
@ -2713,8 +2679,6 @@ nsCacheService::Unlock()
|
||||
gService->LockReleased();
|
||||
gService->mLock.Unlock();
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(nsCacheService::gService, "net::cache::lock");
|
||||
|
||||
for (uint32_t i = 0; i < doomed.Length(); ++i)
|
||||
doomed[i]->Release();
|
||||
}
|
||||
@ -2820,12 +2784,6 @@ nsCacheService::DeactivateEntry(nsCacheEntry * entry)
|
||||
nsresult
|
||||
nsCacheService::ProcessPendingRequests(nsCacheEntry * entry)
|
||||
{
|
||||
mozilla::eventtracer::AutoEventTracer tracer(
|
||||
entry,
|
||||
eventtracer::eExec,
|
||||
eventtracer::eDone,
|
||||
"net::cache::ProcessPendingRequests");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
nsCacheRequest * request = (nsCacheRequest *)PR_LIST_HEAD(&entry->mRequestQ);
|
||||
nsCacheRequest * nextRequest;
|
||||
|
13
netwerk/cache/nsDiskCacheMap.cpp
vendored
13
netwerk/cache/nsDiskCacheMap.cpp
vendored
@ -20,7 +20,6 @@
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/Snprintf.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
@ -892,12 +891,6 @@ nsDiskCacheMap::WriteDiskCacheEntry(nsDiskCacheBinding * binding)
|
||||
CACHE_LOG_DEBUG(("CACHE: WriteDiskCacheEntry [%x]\n",
|
||||
binding->mRecord.HashNumber()));
|
||||
|
||||
mozilla::eventtracer::AutoEventTracer writeDiskCacheEntry(
|
||||
binding->mCacheEntry,
|
||||
mozilla::eventtracer::eExec,
|
||||
mozilla::eventtracer::eDone,
|
||||
"net::cache::WriteDiskCacheEntry");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
uint32_t size;
|
||||
nsDiskCacheEntry * diskEntry = CreateDiskCacheEntry(binding, &size);
|
||||
@ -1022,12 +1015,6 @@ nsDiskCacheMap::WriteDataCacheBlocks(nsDiskCacheBinding * binding, char * buffer
|
||||
CACHE_LOG_DEBUG(("CACHE: WriteDataCacheBlocks [%x size=%u]\n",
|
||||
binding->mRecord.HashNumber(), size));
|
||||
|
||||
mozilla::eventtracer::AutoEventTracer writeDataCacheBlocks(
|
||||
binding->mCacheEntry,
|
||||
mozilla::eventtracer::eExec,
|
||||
mozilla::eventtracer::eDone,
|
||||
"net::cache::WriteDataCacheBlocks");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
// determine block file & number of blocks
|
||||
|
13
netwerk/cache/nsDiskCacheStreams.cpp
vendored
13
netwerk/cache/nsDiskCacheStreams.cpp
vendored
@ -16,7 +16,6 @@
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include <algorithm>
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
|
||||
// we pick 16k as the max buffer size because that is the threshold above which
|
||||
// we are unable to store the data in the cache block files
|
||||
@ -536,12 +535,6 @@ nsDiskCacheStreamIO::OpenCacheFile(int flags, PRFileDesc ** fd)
|
||||
nsresult
|
||||
nsDiskCacheStreamIO::ReadCacheBlocks(uint32_t bufferSize)
|
||||
{
|
||||
mozilla::eventtracer::AutoEventTracer readCacheBlocks(
|
||||
mBinding->mCacheEntry,
|
||||
mozilla::eventtracer::eExec,
|
||||
mozilla::eventtracer::eDone,
|
||||
"net::cache::ReadCacheBlocks");
|
||||
|
||||
NS_ASSERTION(mStreamEnd == mBinding->mCacheEntry->DataSize(), "bad stream");
|
||||
NS_ASSERTION(bufferSize <= kMaxBufferSize, "bufferSize too large for buffer");
|
||||
NS_ASSERTION(mStreamEnd <= bufferSize, "data too large for buffer");
|
||||
@ -565,12 +558,6 @@ nsDiskCacheStreamIO::ReadCacheBlocks(uint32_t bufferSize)
|
||||
nsresult
|
||||
nsDiskCacheStreamIO::FlushBufferToFile()
|
||||
{
|
||||
mozilla::eventtracer::AutoEventTracer flushBufferToFile(
|
||||
mBinding->mCacheEntry,
|
||||
mozilla::eventtracer::eExec,
|
||||
mozilla::eventtracer::eDone,
|
||||
"net::cache::FlushBufferToFile");
|
||||
|
||||
nsresult rv;
|
||||
nsDiskCacheRecord * record = &mBinding->mRecord;
|
||||
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "nsDirectoryServiceUtils.h"
|
||||
#include "nsAppDirectoryServiceDefs.h"
|
||||
#include "private/pprio.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
||||
@ -553,9 +552,6 @@ public:
|
||||
{
|
||||
MOZ_COUNT_CTOR(OpenFileEvent);
|
||||
mIOMan = CacheFileIOManager::gInstance;
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(static_cast<nsIRunnable*>(this), aKey.BeginReading());
|
||||
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::open-background");
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -575,7 +571,6 @@ public:
|
||||
sum.finish(mHash);
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::open-background");
|
||||
if (!mIOMan) {
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
} else {
|
||||
@ -588,17 +583,12 @@ public:
|
||||
}
|
||||
mIOMan = nullptr;
|
||||
if (mHandle) {
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(mHandle.get(), mKey.get());
|
||||
if (mHandle->Key().IsEmpty()) {
|
||||
mHandle->Key() = mKey;
|
||||
}
|
||||
}
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::open-background");
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::open-result");
|
||||
mCallback->OnFileOpened(mHandle, rv);
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::open-result");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -623,9 +613,6 @@ public:
|
||||
, mCallback(aCallback)
|
||||
{
|
||||
MOZ_COUNT_CTOR(ReadEvent);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(static_cast<nsIRunnable*>(this), aHandle->Key().get());
|
||||
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::read-background");
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -639,19 +626,14 @@ public:
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::read-background");
|
||||
if (mHandle->IsClosed()) {
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
} else {
|
||||
rv = CacheFileIOManager::gInstance->ReadInternal(
|
||||
mHandle, mOffset, mBuf, mCount);
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::read-background");
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::read-result");
|
||||
mCallback->OnDataRead(mHandle, mBuf, rv);
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::read-result");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -677,9 +659,6 @@ public:
|
||||
, mCallback(aCallback)
|
||||
{
|
||||
MOZ_COUNT_CTOR(WriteEvent);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(static_cast<nsIRunnable*>(this), aHandle->Key().get());
|
||||
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::write-background");
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -697,7 +676,6 @@ public:
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::write-background");
|
||||
if (mHandle->IsClosed()) {
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
} else {
|
||||
@ -708,16 +686,12 @@ public:
|
||||
CacheFileIOManager::gInstance->DoomFileInternal(mHandle);
|
||||
}
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::write-background");
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::write-result");
|
||||
if (mCallback) {
|
||||
mCallback->OnDataWritten(mHandle, mBuf, rv);
|
||||
} else {
|
||||
free(const_cast<char *>(mBuf));
|
||||
mBuf = nullptr;
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::write-result");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -740,9 +714,6 @@ public:
|
||||
, mHandle(aHandle)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DoomFileEvent);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(static_cast<nsIRunnable*>(this), aHandle->Key().get());
|
||||
MOZ_EVENT_TRACER_WAIT(static_cast<nsIRunnable*>(this), "net::cache::doom-background");
|
||||
}
|
||||
|
||||
protected:
|
||||
@ -756,19 +727,15 @@ public:
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::doom-background");
|
||||
if (mHandle->IsClosed()) {
|
||||
rv = NS_ERROR_NOT_INITIALIZED;
|
||||
} else {
|
||||
rv = CacheFileIOManager::gInstance->DoomFileInternal(mHandle);
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::doom-background");
|
||||
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsIRunnable*>(this), "net::cache::doom-result");
|
||||
if (mCallback) {
|
||||
mCallback->OnFileDoomed(mHandle, rv);
|
||||
}
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsIRunnable*>(this), "net::cache::doom-result");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -10,7 +10,6 @@
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsThreadUtils.h"
|
||||
#include "mozilla/IOInterposer.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
@ -196,9 +195,6 @@ loopStart:
|
||||
|
||||
// Process xpcom events first
|
||||
while (mHasXPCOMEvents) {
|
||||
eventtracer::AutoEventTracer tracer(this, eventtracer::eExec, eventtracer::eDone,
|
||||
"net::cache::io::level(xpcom)");
|
||||
|
||||
mHasXPCOMEvents = false;
|
||||
mCurrentlyExecutingLevel = XPCOM_LEVEL;
|
||||
|
||||
@ -265,9 +261,6 @@ static const char* const sLevelTraceName[] = {
|
||||
|
||||
void CacheIOThread::LoopOneLevel(uint32_t aLevel)
|
||||
{
|
||||
eventtracer::AutoEventTracer tracer(this, eventtracer::eExec, eventtracer::eDone,
|
||||
sLevelTraceName[aLevel]);
|
||||
|
||||
nsTArray<nsCOMPtr<nsIRunnable> > events;
|
||||
events.SwapElements(mEventQueue[aLevel]);
|
||||
uint32_t length = events.Length();
|
||||
|
@ -29,7 +29,6 @@
|
||||
#include "nsWeakReference.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "mozilla/Services.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -34,7 +34,6 @@
|
||||
#include "nsINetworkLinkService.h"
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "mozilla/net/NeckoCommon.h"
|
||||
#if !defined(MOZILLA_XPCOMRT_API)
|
||||
#include "mozilla/net/ChildDNSService.h"
|
||||
@ -349,8 +348,6 @@ nsDNSAsyncRequest::OnLookupComplete(nsHostResolver *resolver,
|
||||
status = NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(this, "net::dns::lookup");
|
||||
|
||||
mListener->OnLookupComplete(this, rec, status);
|
||||
mListener = nullptr;
|
||||
|
||||
@ -800,9 +797,6 @@ nsDNSService::AsyncResolveExtended(const nsACString &aHostname,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(*result = req);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(req, aHostname.BeginReading());
|
||||
MOZ_EVENT_TRACER_WAIT(req, "net::dns::lookup");
|
||||
|
||||
// addref for resolver; will be released when OnLookupComplete is called.
|
||||
NS_ADDREF(req);
|
||||
nsresult rv = res->ResolveHost(req->mHost.get(), flags, af,
|
||||
|
@ -33,7 +33,6 @@
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
@ -200,8 +199,6 @@ nsHostRecord::Create(const nsHostKey *key, nsHostRecord **result)
|
||||
*result = new(place) nsHostRecord(key);
|
||||
NS_ADDREF(*result);
|
||||
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(*result, key->host);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1056,8 +1053,6 @@ nsHostResolver::ConditionallyCreateThread(nsHostRecord *rec)
|
||||
nsresult
|
||||
nsHostResolver::IssueLookup(nsHostRecord *rec)
|
||||
{
|
||||
MOZ_EVENT_TRACER_WAIT(rec, "net::dns::resolve");
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
NS_ASSERTION(!rec->resolving, "record is already being resolved");
|
||||
|
||||
@ -1317,8 +1312,6 @@ nsHostResolver::OnLookupComplete(nsHostRecord* rec, nsresult status, AddrInfo* r
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(rec, "net::dns::resolve");
|
||||
|
||||
if (!PR_CLIST_IS_EMPTY(&cbs)) {
|
||||
PRCList *node = cbs.next;
|
||||
while (node != &cbs) {
|
||||
@ -1425,8 +1418,6 @@ nsHostResolver::ThreadFunc(void *arg)
|
||||
LOG_HOST(rec->host, rec->netInterface)));
|
||||
|
||||
TimeStamp startTime = TimeStamp::Now();
|
||||
MOZ_EVENT_TRACER_EXEC(rec, "net::dns::resolve");
|
||||
|
||||
#if TTL_AVAILABLE
|
||||
bool getTtl = rec->mGetTtl;
|
||||
#else
|
||||
|
@ -43,7 +43,6 @@
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "nsISSLSocketControl.h"
|
||||
#include "sslt.h"
|
||||
#include "nsContentUtils.h"
|
||||
@ -214,8 +213,6 @@ AutoRedirectVetoNotifier::ReportRedirectResult(bool succeeded)
|
||||
|
||||
// Drop after the notification
|
||||
channel->mHasAutoRedirectVetoNotifier = false;
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(channel, "net::http::redirect-callbacks");
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
@ -276,12 +273,6 @@ nsHttpChannel::Init(nsIURI *uri,
|
||||
uint32_t proxyResolveFlags,
|
||||
nsIURI *proxyURI)
|
||||
{
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
nsAutoCString url;
|
||||
uri->GetAsciiSpec(url);
|
||||
MOZ_EVENT_TRACER_NAME_OBJECT(this, url.get());
|
||||
#endif
|
||||
|
||||
nsresult rv = HttpBaseChannel::Init(uri, caps, proxyInfo,
|
||||
proxyResolveFlags, proxyURI);
|
||||
if (NS_FAILED(rv))
|
||||
@ -2674,8 +2665,6 @@ IsSubRangeRequest(nsHttpRequestHead &aRequestHead)
|
||||
nsresult
|
||||
nsHttpChannel::OpenCacheEntry(bool isHttps)
|
||||
{
|
||||
MOZ_EVENT_TRACER_EXEC(this, "net::http::OpenCacheEntry");
|
||||
|
||||
// Handle correctly mCacheEntriesToWaitFor
|
||||
AutoCacheWaitFlags waitFlags(this);
|
||||
|
||||
@ -4405,11 +4394,6 @@ nsHttpChannel::AsyncProcessRedirection(uint32_t redirectType)
|
||||
LOG(("nsHttpChannel::AsyncProcessRedirection [this=%p type=%u]\n",
|
||||
this, redirectType));
|
||||
|
||||
// The channel is actually starting its operation now, at least because
|
||||
// we want it to appear like being in the waiting phase until now.
|
||||
MOZ_EVENT_TRACER_EXEC(this, "net::http::channel");
|
||||
MOZ_EVENT_TRACER_EXEC(this, "net::http::redirect-callbacks");
|
||||
|
||||
const char *location = mResponseHead->PeekHeader(nsHttp::Location);
|
||||
|
||||
// if a location header was not given, then we can't perform the redirect,
|
||||
@ -4769,8 +4753,6 @@ nsHttpChannel::GetSecurityInfo(nsISupports **securityInfo)
|
||||
NS_IMETHODIMP
|
||||
nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context)
|
||||
{
|
||||
MOZ_EVENT_TRACER_WAIT(this, "net::http::channel");
|
||||
|
||||
LOG(("nsHttpChannel::AsyncOpen [this=%p]\n", this));
|
||||
|
||||
NS_ENSURE_ARG_POINTER(listener);
|
||||
@ -5698,8 +5680,6 @@ nsHttpChannel::OnStopRequest(nsIRequest *request, nsISupports *ctxt, nsresult st
|
||||
mListener->OnStopRequest(this, mListenerContext, status);
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(this, "net::http::channel");
|
||||
|
||||
CloseCacheEntry(!contentComplete);
|
||||
|
||||
if (mOfflineCacheEntry)
|
||||
@ -5825,9 +5805,6 @@ nsHttpChannel::OnDataAvailable(nsIRequest *request, nsISupports *ctxt,
|
||||
// already streamed some data from another source (see, for example,
|
||||
// OnDoneReadingPartialCacheEntry).
|
||||
//
|
||||
if (!mLogicalOffset)
|
||||
MOZ_EVENT_TRACER_EXEC(this, "net::http::channel");
|
||||
|
||||
int64_t offsetBefore = 0;
|
||||
nsCOMPtr<nsISeekableStream> seekable = do_QueryInterface(input);
|
||||
if (seekable && NS_FAILED(seekable->Tell(&offsetBefore))) {
|
||||
@ -6411,7 +6388,6 @@ nsHttpChannel::OnRedirectVerifyCallback(nsresult result)
|
||||
// We are not waiting for the callback. At this moment we must release
|
||||
// reference to the redirect target channel, otherwise we may leak.
|
||||
mRedirectChannel = nullptr;
|
||||
MOZ_EVENT_TRACER_DONE(this, "net::http::channel");
|
||||
}
|
||||
|
||||
// We always resume the pumps here. If all functions on stack have been
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "nsISeekableStream.h"
|
||||
#include "nsMultiplexInputStream.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
|
||||
#include "nsComponentManagerUtils.h" // do_CreateInstance
|
||||
#include "nsServiceManagerUtils.h" // do_GetService
|
||||
@ -218,12 +217,6 @@ nsHttpTransaction::Init(uint32_t caps,
|
||||
nsITransportEventSink *eventsink,
|
||||
nsIAsyncInputStream **responseBody)
|
||||
{
|
||||
MOZ_EVENT_TRACER_COMPOUND_NAME(static_cast<nsAHttpTransaction*>(this),
|
||||
requestHead->PeekHeader(nsHttp::Host),
|
||||
requestHead->RequestURI().BeginReading());
|
||||
|
||||
MOZ_EVENT_TRACER_WAIT(static_cast<nsAHttpTransaction*>(this),
|
||||
"net::http::transaction");
|
||||
nsresult rv;
|
||||
|
||||
LOG(("nsHttpTransaction::Init [this=%p caps=%x]\n", this, caps));
|
||||
@ -478,11 +471,6 @@ nsHttpTransaction::SetConnection(nsAHttpConnection *conn)
|
||||
MutexAutoLock lock(mLock);
|
||||
mConnection = conn;
|
||||
}
|
||||
|
||||
if (conn) {
|
||||
MOZ_EVENT_TRACER_EXEC(static_cast<nsAHttpTransaction*>(this),
|
||||
"net::http::transaction");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
@ -658,11 +646,6 @@ nsHttpTransaction::ReadRequestSegment(nsIInputStream *stream,
|
||||
trans->SetRequestStart(TimeStamp::Now(), true);
|
||||
}
|
||||
|
||||
if (!trans->mSentData) {
|
||||
MOZ_EVENT_TRACER_MARK(static_cast<nsAHttpTransaction*>(trans),
|
||||
"net::http::first-write");
|
||||
}
|
||||
|
||||
trans->CountSentBytes(*countRead);
|
||||
trans->mSentData = true;
|
||||
return NS_OK;
|
||||
@ -741,11 +724,6 @@ nsHttpTransaction::WritePipeSegment(nsIOutputStream *stream,
|
||||
rv = trans->mWriter->OnWriteSegment(buf, count, countWritten);
|
||||
if (NS_FAILED(rv)) return rv; // caller didn't want to write anything
|
||||
|
||||
if (!trans->mReceivedData) {
|
||||
MOZ_EVENT_TRACER_MARK(static_cast<nsAHttpTransaction*>(trans),
|
||||
"net::http::first-read");
|
||||
}
|
||||
|
||||
MOZ_ASSERT(*countWritten > 0, "bad writer");
|
||||
trans->CountRecvBytes(*countWritten);
|
||||
trans->mReceivedData = true;
|
||||
@ -1035,9 +1013,6 @@ nsHttpTransaction::Close(nsresult reason)
|
||||
|
||||
// closing this pipe triggers the channel's OnStopRequest method.
|
||||
mPipeOut->CloseWithStatus(reason);
|
||||
|
||||
MOZ_EVENT_TRACER_DONE(static_cast<nsAHttpTransaction*>(this),
|
||||
"net::http::transaction");
|
||||
}
|
||||
|
||||
nsHttpConnectionInfo *
|
||||
|
@ -1,713 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#include "mozilla/Monitor.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "nscore.h"
|
||||
#include "prthread.h"
|
||||
#include "prprf.h"
|
||||
#include "prenv.h"
|
||||
#include "plstr.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace eventtracer {
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
|
||||
namespace {
|
||||
|
||||
const uint32_t kBatchSize = 256;
|
||||
const char kTypeChars[eventtracer::eLast] = {' ', 'N', 'S', 'W', 'E', 'D'};
|
||||
|
||||
// Flushing thread and records queue monitor
|
||||
mozilla::Monitor* gMonitor = nullptr;
|
||||
|
||||
// gInitialized and gCapture can be accessed from multiple threads
|
||||
// simultaneously without any locking. However, since they are only ever
|
||||
// *set* from the main thread, the chance of races manifesting is small
|
||||
// and unlikely to be a problem in practice.
|
||||
bool gInitialized;
|
||||
|
||||
// Flag to allow capturing
|
||||
bool gCapture;
|
||||
|
||||
// Time stamp of the epoch we have started to capture
|
||||
mozilla::TimeStamp* gProfilerStart;
|
||||
|
||||
// Duration of the log to keep up to
|
||||
mozilla::TimeDuration* gMaxBacklogTime;
|
||||
|
||||
|
||||
// Record of a single event
|
||||
class Record
|
||||
{
|
||||
public:
|
||||
Record()
|
||||
: mType(::mozilla::eventtracer::eNone)
|
||||
, mItem(nullptr)
|
||||
, mText(nullptr)
|
||||
, mText2(nullptr)
|
||||
{
|
||||
MOZ_COUNT_CTOR(Record);
|
||||
}
|
||||
|
||||
Record& operator=(const Record& aOther)
|
||||
{
|
||||
mType = aOther.mType;
|
||||
mTime = aOther.mTime;
|
||||
mItem = aOther.mItem;
|
||||
mText = PL_strdup(aOther.mText);
|
||||
mText2 = aOther.mText2 ? PL_strdup(aOther.mText2) : nullptr;
|
||||
return *this;
|
||||
}
|
||||
|
||||
~Record()
|
||||
{
|
||||
PL_strfree(mText2);
|
||||
PL_strfree(mText);
|
||||
MOZ_COUNT_DTOR(Record);
|
||||
}
|
||||
|
||||
uint32_t mType;
|
||||
TimeStamp mTime;
|
||||
void* mItem;
|
||||
char* mText;
|
||||
char* mText2;
|
||||
};
|
||||
|
||||
char* DupCurrentThreadName()
|
||||
{
|
||||
if (NS_IsMainThread()) {
|
||||
return PL_strdup("Main Thread");
|
||||
}
|
||||
|
||||
PRThread* currentThread = PR_GetCurrentThread();
|
||||
const char* name = PR_GetThreadName(currentThread);
|
||||
if (name) {
|
||||
return PL_strdup(name);
|
||||
}
|
||||
|
||||
char buffer[128];
|
||||
PR_snprintf(buffer, 127, "Nameless %p", currentThread);
|
||||
|
||||
return PL_strdup(buffer);
|
||||
}
|
||||
|
||||
// An array of events, each thread keeps its own private instance
|
||||
class RecordBatch
|
||||
{
|
||||
public:
|
||||
RecordBatch(size_t aLength = kBatchSize,
|
||||
char* aThreadName = DupCurrentThreadName())
|
||||
: mRecordsHead(new Record[aLength])
|
||||
, mRecordsTail(mRecordsHead + aLength)
|
||||
, mNextRecord(mRecordsHead)
|
||||
, mNextBatch(nullptr)
|
||||
, mThreadNameCopy(aThreadName)
|
||||
, mClosed(false)
|
||||
{
|
||||
MOZ_COUNT_CTOR(RecordBatch);
|
||||
}
|
||||
|
||||
~RecordBatch()
|
||||
{
|
||||
delete [] mRecordsHead;
|
||||
PL_strfree(mThreadNameCopy);
|
||||
MOZ_COUNT_DTOR(RecordBatch);
|
||||
}
|
||||
|
||||
void Close()
|
||||
{
|
||||
mClosed = true;
|
||||
}
|
||||
|
||||
size_t Length() const
|
||||
{
|
||||
return mNextRecord - mRecordsHead;
|
||||
}
|
||||
bool CanBeDeleted(const TimeStamp& aUntil) const;
|
||||
|
||||
static RecordBatch* Register();
|
||||
static void Close(void* aData); // Registered on freeing thread data
|
||||
static RecordBatch* Clone(RecordBatch* aLog, const TimeStamp& aSince);
|
||||
static void Delete(RecordBatch* aLog);
|
||||
|
||||
static RecordBatch* CloneLog();
|
||||
static void GCLog(const TimeStamp& aUntil);
|
||||
static void DeleteLog();
|
||||
|
||||
Record* mRecordsHead;
|
||||
Record* mRecordsTail;
|
||||
Record* mNextRecord;
|
||||
|
||||
RecordBatch* mNextBatch;
|
||||
char* mThreadNameCopy;
|
||||
bool mClosed;
|
||||
};
|
||||
|
||||
// Protected by gMonitor, accessed concurently
|
||||
// Linked list of batches threads want to flush on disk
|
||||
RecordBatch* gLogHead = nullptr;
|
||||
RecordBatch* gLogTail = nullptr;
|
||||
|
||||
// Registers the batch in the linked list
|
||||
// static
|
||||
RecordBatch*
|
||||
RecordBatch::Register()
|
||||
{
|
||||
MonitorAutoLock mon(*gMonitor);
|
||||
|
||||
if (!gInitialized) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (gLogHead) {
|
||||
RecordBatch::GCLog(TimeStamp::Now() - *gMaxBacklogTime);
|
||||
}
|
||||
|
||||
RecordBatch* batch = new RecordBatch();
|
||||
if (!gLogHead) {
|
||||
gLogHead = batch;
|
||||
} else { // gLogTail is non-null
|
||||
gLogTail->mNextBatch = batch;
|
||||
}
|
||||
gLogTail = batch;
|
||||
|
||||
mon.Notify();
|
||||
return batch;
|
||||
}
|
||||
|
||||
void
|
||||
RecordBatch::Close(void* aData)
|
||||
{
|
||||
RecordBatch* batch = static_cast<RecordBatch*>(aData);
|
||||
batch->Close();
|
||||
}
|
||||
|
||||
// static
|
||||
RecordBatch*
|
||||
RecordBatch::Clone(RecordBatch* aOther, const TimeStamp& aSince)
|
||||
{
|
||||
if (!aOther) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t length = aOther->Length();
|
||||
size_t min = 0;
|
||||
size_t max = length;
|
||||
Record* record = nullptr;
|
||||
|
||||
// Binary search for record with time >= aSince
|
||||
size_t i;
|
||||
while (min < max) {
|
||||
i = (max + min) / 2;
|
||||
|
||||
record = aOther->mRecordsHead + i;
|
||||
if (record->mTime >= aSince) {
|
||||
max = i;
|
||||
} else {
|
||||
min = i + 1;
|
||||
}
|
||||
}
|
||||
i = (max + min) / 2;
|
||||
|
||||
// How many Record's to copy?
|
||||
size_t toCopy = length - i;
|
||||
if (!toCopy) {
|
||||
return RecordBatch::Clone(aOther->mNextBatch, aSince);
|
||||
}
|
||||
|
||||
// Clone
|
||||
RecordBatch* clone = new RecordBatch(toCopy, PL_strdup(aOther->mThreadNameCopy));
|
||||
for (; i < length; ++i) {
|
||||
record = aOther->mRecordsHead + i;
|
||||
*clone->mNextRecord = *record;
|
||||
++clone->mNextRecord;
|
||||
}
|
||||
clone->mNextBatch = RecordBatch::Clone(aOther->mNextBatch, aSince);
|
||||
|
||||
return clone;
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
RecordBatch::Delete(RecordBatch* aLog)
|
||||
{
|
||||
while (aLog) {
|
||||
RecordBatch* batch = aLog;
|
||||
aLog = aLog->mNextBatch;
|
||||
delete batch;
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
RecordBatch*
|
||||
RecordBatch::CloneLog()
|
||||
{
|
||||
TimeStamp startEpoch = *gProfilerStart;
|
||||
TimeStamp backlogEpoch = TimeStamp::Now() - *gMaxBacklogTime;
|
||||
|
||||
TimeStamp since = (startEpoch > backlogEpoch) ? startEpoch : backlogEpoch;
|
||||
|
||||
MonitorAutoLock mon(*gMonitor);
|
||||
|
||||
return RecordBatch::Clone(gLogHead, since);
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
RecordBatch::GCLog(const TimeStamp& aUntil)
|
||||
{
|
||||
// Garbage collect all unreferenced and old batches
|
||||
gMonitor->AssertCurrentThreadOwns();
|
||||
|
||||
RecordBatch* volatile* referer = &gLogHead;
|
||||
gLogTail = nullptr;
|
||||
|
||||
RecordBatch* batch = *referer;
|
||||
while (batch) {
|
||||
if (batch->CanBeDeleted(aUntil)) {
|
||||
// The batch is completed and thus unreferenced by the thread
|
||||
// and the most recent record has time older then the time
|
||||
// we want to save records for, hence delete it.
|
||||
*referer = batch->mNextBatch;
|
||||
delete batch;
|
||||
batch = *referer;
|
||||
} else {
|
||||
// We walk the whole list, so this will end up filled with
|
||||
// the very last valid element of it.
|
||||
gLogTail = batch;
|
||||
// The current batch is active, examine the next in the list.
|
||||
batch = batch->mNextBatch;
|
||||
// When the next batch is found expired, we must extract it
|
||||
// from the list, shift the referer.
|
||||
referer = &((*referer)->mNextBatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
RecordBatch::DeleteLog()
|
||||
{
|
||||
RecordBatch* batch;
|
||||
{
|
||||
MonitorAutoLock mon(*gMonitor);
|
||||
batch = gLogHead;
|
||||
gLogHead = nullptr;
|
||||
gLogTail = nullptr;
|
||||
}
|
||||
|
||||
RecordBatch::Delete(batch);
|
||||
}
|
||||
|
||||
bool
|
||||
RecordBatch::CanBeDeleted(const TimeStamp& aUntil) const
|
||||
{
|
||||
if (mClosed) {
|
||||
// This flag is set when a thread releases this batch as
|
||||
// its private data. It happens when the list is full or
|
||||
// when the thread ends its job. We must not delete this
|
||||
// batch from memory while it's held by a thread.
|
||||
|
||||
if (!Length()) {
|
||||
// There are no records, just get rid of this empty batch.
|
||||
return true;
|
||||
}
|
||||
|
||||
if ((mNextRecord - 1)->mTime <= aUntil) {
|
||||
// Is the last record older then the time we demand records
|
||||
// for? If not, this batch has expired.
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Not all conditions to close the batch met, keep it.
|
||||
return false;
|
||||
}
|
||||
|
||||
// Helper class for filtering events by MOZ_PROFILING_EVENTS
|
||||
class EventFilter
|
||||
{
|
||||
public:
|
||||
static EventFilter* Build(const char* aFilterVar);
|
||||
bool EventPasses(const char* aFilterVar);
|
||||
|
||||
~EventFilter()
|
||||
{
|
||||
delete mNext;
|
||||
PL_strfree(mFilter);
|
||||
MOZ_COUNT_DTOR(EventFilter);
|
||||
}
|
||||
|
||||
private:
|
||||
EventFilter(const char* aEventName, EventFilter* aNext)
|
||||
: mFilter(PL_strdup(aEventName))
|
||||
, mNext(aNext)
|
||||
{
|
||||
MOZ_COUNT_CTOR(EventFilter);
|
||||
}
|
||||
|
||||
char* mFilter;
|
||||
EventFilter* mNext;
|
||||
};
|
||||
|
||||
// static
|
||||
EventFilter*
|
||||
EventFilter::Build(const char* aFilterVar)
|
||||
{
|
||||
if (!aFilterVar || !*aFilterVar) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Reads a comma serpatated list of events.
|
||||
|
||||
// Copied from nspr logging code (read of NSPR_LOG_MODULES)
|
||||
char eventName[64];
|
||||
int pos = 0, count, delta = 0;
|
||||
|
||||
// Read up to a comma or EOF -> get name of an event first in the list
|
||||
count = sscanf(aFilterVar, "%63[^,]%n", eventName, &delta);
|
||||
if (count == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
pos = delta;
|
||||
|
||||
// Skip a comma, if present, accept spaces around it
|
||||
count = sscanf(aFilterVar + pos, " , %n", &delta);
|
||||
if (count != EOF) {
|
||||
pos += delta;
|
||||
}
|
||||
|
||||
// eventName contains name of the first event in the list
|
||||
// second argument recursively parses the rest of the list string and
|
||||
// fills mNext of the just created EventFilter object chaining the objects
|
||||
return new EventFilter(eventName, Build(aFilterVar + pos));
|
||||
}
|
||||
|
||||
bool
|
||||
EventFilter::EventPasses(const char* aEventName)
|
||||
{
|
||||
if (!strcmp(aEventName, mFilter)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (mNext) {
|
||||
return mNext->EventPasses(aEventName);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// State and control variables, initialized in Init() method, after it
|
||||
// immutable and read concurently.
|
||||
EventFilter* gEventFilter = nullptr;
|
||||
unsigned gThreadPrivateIndex;
|
||||
|
||||
// static
|
||||
bool
|
||||
CheckEventFilters(uint32_t aType, void* aItem, const char* aText)
|
||||
{
|
||||
if (!gEventFilter) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aType == eName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return gEventFilter->EventPasses(aText);
|
||||
}
|
||||
|
||||
} // anon namespace
|
||||
|
||||
#endif //MOZ_VISUAL_EVENT_TRACER
|
||||
|
||||
// static
|
||||
void
|
||||
Init()
|
||||
{
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
const char* logEvents = PR_GetEnv("MOZ_PROFILING_EVENTS");
|
||||
if (logEvents && *logEvents) {
|
||||
gEventFilter = EventFilter::Build(logEvents);
|
||||
}
|
||||
|
||||
PRStatus status = PR_NewThreadPrivateIndex(&gThreadPrivateIndex,
|
||||
&RecordBatch::Close);
|
||||
if (status != PR_SUCCESS) {
|
||||
return;
|
||||
}
|
||||
|
||||
gMonitor = new mozilla::Monitor("Profiler");
|
||||
if (!gMonitor) {
|
||||
return;
|
||||
}
|
||||
|
||||
gProfilerStart = new mozilla::TimeStamp();
|
||||
gMaxBacklogTime = new mozilla::TimeDuration();
|
||||
|
||||
gInitialized = true;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
Shutdown()
|
||||
{
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
gCapture = false;
|
||||
gInitialized = false;
|
||||
|
||||
RecordBatch::DeleteLog();
|
||||
|
||||
delete gMonitor;
|
||||
gMonitor = nullptr;
|
||||
|
||||
delete gEventFilter;
|
||||
gEventFilter = nullptr;
|
||||
|
||||
delete gProfilerStart;
|
||||
gProfilerStart = nullptr;
|
||||
|
||||
delete gMaxBacklogTime;
|
||||
gMaxBacklogTime = nullptr;
|
||||
#endif
|
||||
}
|
||||
|
||||
// static
|
||||
void
|
||||
Mark(uint32_t aType, void* aItem, const char* aText, const char* aText2)
|
||||
{
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
if (!gInitialized || !gCapture) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (aType == eNone) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!CheckEventFilters(aType, aItem, aText)) { // Events use just aText
|
||||
return;
|
||||
}
|
||||
|
||||
RecordBatch* threadLogPrivate =
|
||||
static_cast<RecordBatch*>(PR_GetThreadPrivate(gThreadPrivateIndex));
|
||||
if (!threadLogPrivate) {
|
||||
threadLogPrivate = RecordBatch::Register();
|
||||
if (!threadLogPrivate) {
|
||||
return;
|
||||
}
|
||||
|
||||
PR_SetThreadPrivate(gThreadPrivateIndex, threadLogPrivate);
|
||||
}
|
||||
|
||||
Record* record = threadLogPrivate->mNextRecord;
|
||||
record->mType = aType;
|
||||
record->mTime = mozilla::TimeStamp::Now();
|
||||
record->mItem = aItem;
|
||||
record->mText = PL_strdup(aText);
|
||||
record->mText2 = aText2 ? PL_strdup(aText2) : nullptr;
|
||||
|
||||
++threadLogPrivate->mNextRecord;
|
||||
if (threadLogPrivate->mNextRecord == threadLogPrivate->mRecordsTail) {
|
||||
// Calls RecordBatch::Close(threadLogPrivate) that marks
|
||||
// the batch as OK to be deleted from memory when no longer needed.
|
||||
PR_SetThreadPrivate(gThreadPrivateIndex, nullptr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
|
||||
// The scriptable classes
|
||||
|
||||
class VisualEventTracerLog final: public nsIVisualEventTracerLog
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIVISUALEVENTTRACERLOG
|
||||
|
||||
VisualEventTracerLog(RecordBatch* aBatch)
|
||||
: mBatch(aBatch)
|
||||
, mProfilerStart(*gProfilerStart)
|
||||
{
|
||||
}
|
||||
private:
|
||||
~VisualEventTracerLog();
|
||||
|
||||
protected:
|
||||
RecordBatch* mBatch;
|
||||
TimeStamp mProfilerStart;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(VisualEventTracerLog, nsIVisualEventTracerLog)
|
||||
|
||||
VisualEventTracerLog::~VisualEventTracerLog()
|
||||
{
|
||||
RecordBatch::Delete(mBatch);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
VisualEventTracerLog::GetJSONString(nsACString& aResult)
|
||||
{
|
||||
nsCString buffer;
|
||||
buffer.AssignLiteral("{\n\"version\": 1,\n\"records\":[\n");
|
||||
|
||||
RecordBatch* batch = mBatch;
|
||||
while (batch) {
|
||||
if (batch != mBatch) {
|
||||
// This is not the first batch we are writting, add comma
|
||||
buffer.AppendLiteral(",\n");
|
||||
}
|
||||
|
||||
buffer.AppendLiteral("{\"thread\":\"");
|
||||
buffer.Append(batch->mThreadNameCopy);
|
||||
buffer.AppendLiteral("\",\"log\":[\n");
|
||||
|
||||
static const int kBufferSize = 2048;
|
||||
char buf[kBufferSize];
|
||||
|
||||
for (Record* record = batch->mRecordsHead;
|
||||
record < batch->mNextRecord;
|
||||
++record) {
|
||||
|
||||
// mType carries both type and flags, separate type
|
||||
// as lower 16 bits and flags as higher 16 bits.
|
||||
// The json format expects this separated.
|
||||
uint32_t type = record->mType & 0xffffUL;
|
||||
uint32_t flags = record->mType >> 16;
|
||||
PR_snprintf(buf, kBufferSize,
|
||||
"{\"e\":\"%c\",\"t\":%llu,\"f\":%d,\"i\":\"%p\",\"n\":\"%s%s\"}%s\n",
|
||||
kTypeChars[type],
|
||||
static_cast<uint64_t>((record->mTime - mProfilerStart).ToMilliseconds()),
|
||||
flags,
|
||||
record->mItem,
|
||||
record->mText,
|
||||
record->mText2 ? record->mText2 : "",
|
||||
(record == batch->mNextRecord - 1) ? "" : ",");
|
||||
|
||||
buffer.Append(buf);
|
||||
}
|
||||
|
||||
buffer.AppendLiteral("]}\n");
|
||||
|
||||
RecordBatch* next = batch->mNextBatch;
|
||||
batch = next;
|
||||
}
|
||||
|
||||
buffer.AppendLiteral("]}\n");
|
||||
aResult.Assign(buffer);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
VisualEventTracerLog::WriteToProfilingFile()
|
||||
{
|
||||
const char* filename = PR_GetEnv("MOZ_TRACE_FILE");
|
||||
if (!filename) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
PRFileDesc* fd = PR_Open(filename, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE,
|
||||
0644);
|
||||
if (!fd) {
|
||||
return NS_ERROR_FILE_ACCESS_DENIED;
|
||||
}
|
||||
|
||||
nsCString json;
|
||||
GetJSONString(json);
|
||||
|
||||
int32_t bytesWritten = PR_Write(fd, json.get(), json.Length());
|
||||
PR_Close(fd);
|
||||
|
||||
if (bytesWritten < json.Length()) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(VisualEventTracer, nsIVisualEventTracer)
|
||||
|
||||
NS_IMETHODIMP
|
||||
VisualEventTracer::Start(const uint32_t aMaxBacklogSeconds)
|
||||
{
|
||||
if (!gInitialized) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (gCapture) {
|
||||
NS_WARNING("VisualEventTracer has already been started");
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
|
||||
*gMaxBacklogTime = TimeDuration::FromMilliseconds(aMaxBacklogSeconds * 1000);
|
||||
|
||||
*gProfilerStart = mozilla::TimeStamp::Now();
|
||||
{
|
||||
MonitorAutoLock mon(*gMonitor);
|
||||
RecordBatch::GCLog(*gProfilerStart);
|
||||
}
|
||||
gCapture = true;
|
||||
|
||||
MOZ_EVENT_TRACER_MARK(this, "trace::start");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
VisualEventTracer::Stop()
|
||||
{
|
||||
if (!gInitialized) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
if (!gCapture) {
|
||||
NS_WARNING("VisualEventTracer is not runing");
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
|
||||
MOZ_EVENT_TRACER_MARK(this, "trace::stop");
|
||||
|
||||
gCapture = false;
|
||||
|
||||
nsresult rv = NS_OK;
|
||||
if (PR_GetEnv("MOZ_TRACE_FILE")) {
|
||||
nsCOMPtr<nsIVisualEventTracerLog> tracelog;
|
||||
rv = Snapshot(getter_AddRefs(tracelog));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = tracelog->WriteToProfilingFile();
|
||||
}
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
VisualEventTracer::Snapshot(nsIVisualEventTracerLog** aResult)
|
||||
{
|
||||
if (!gInitialized) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RecordBatch* batch = RecordBatch::CloneLog();
|
||||
|
||||
nsRefPtr<VisualEventTracerLog> log = new VisualEventTracerLog(batch);
|
||||
log.forget(aResult);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // eventtracer
|
||||
} // mozilla
|
@ -1,236 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Visual event tracer, creates a log of events on each thread for visualization */
|
||||
|
||||
/**
|
||||
* The event tracer code is by default disabled in both build and run time.
|
||||
*
|
||||
* To enable this code at build time, add --enable-visual-profiling to your
|
||||
* configure options.
|
||||
*
|
||||
* To enable this code at run time, export MOZ_TRACE_FILE env var with a
|
||||
* path to the file to write the log to. This is all you need to * produce
|
||||
* the log of all events instrumentation in the mozilla code. Check
|
||||
* MOZ_EVENT_TRACER_* macros below to add your own.
|
||||
*
|
||||
* To let the event tracer log only some events to save disk space, export
|
||||
* MOZ_PROFILING_EVENTS with comma separated list of event names you want
|
||||
* to record in the log.
|
||||
*/
|
||||
|
||||
#ifndef VisualEventTracer_h___
|
||||
#define VisualEventTracer_h___
|
||||
|
||||
#include <stdint.h>
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/GuardObjects.h"
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
#include "nsIVisualEventTracer.h"
|
||||
|
||||
// Bind an object instance, usually |this|, to a name, usually URL or
|
||||
// host name, the instance deals with for its lifetime. The name string
|
||||
// is duplicated.
|
||||
// IMPORTANT: it is up to the caller to pass the correct static_cast
|
||||
// of the |instance| pointer to all these macros ; otherwise the linking
|
||||
// of events and objects will not work!
|
||||
// The name will show in details of the events on the timeline and also
|
||||
// will allow events filtering by host names, URLs etc.
|
||||
#define MOZ_EVENT_TRACER_NAME_OBJECT(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eName, instance, name)
|
||||
|
||||
// The same as MOZ_EVENT_TRACER_NAME_OBJECT, just simplifies building
|
||||
// names when it consists of two parts
|
||||
#define MOZ_EVENT_TRACER_COMPOUND_NAME(instance, name, name2) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eName, instance, name, name2)
|
||||
|
||||
|
||||
// Call the followings with the same |instance| reference as you have
|
||||
// previously called MOZ_EVENT_TRACER_NAME_OBJECT.
|
||||
// Let |name| be the name of the event happening, like "resolving",
|
||||
// "connecting", "loading" etc.
|
||||
|
||||
// This will crate a single-point-in-time event marked with an arrow
|
||||
// on the timeline, this is a way to indicate an event without a duration.
|
||||
#define MOZ_EVENT_TRACER_MARK(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eShot, instance, name)
|
||||
|
||||
// Following macros are used to log events with duration.
|
||||
// There always has to be complete WAIT,EXEC,DONE or EXEC,DONE
|
||||
// uninterrupted and non-interferring tuple(s) for an event to be correctly
|
||||
// shown on the timeline. Each can be called on any thread, the event tape is
|
||||
// finally displayed on the thread where it has been EXECuted.
|
||||
|
||||
// Example of 3 phases usage for "HTTP request channel":
|
||||
// WAIT: we've just created the channel and called AsyncOpen on it
|
||||
// EXEC: we've just got first call to OnDataAvailable, so we are actually
|
||||
// receiving the content after some time like connection establising,
|
||||
// opening a cache entry, sending the GET request...
|
||||
// DONE: we've just got OnStopRequest call that indicates the content
|
||||
// has been completely delivered and the request is now finished
|
||||
|
||||
// Indicate an event pending start, on the timeline this will
|
||||
// start the event's interval tape with a pale color, the time will
|
||||
// show in details. Usually used when an event is being posted or
|
||||
// we wait for a lock acquisition.
|
||||
// WAITING is not mandatory, some events don't have a pending phase.
|
||||
#define MOZ_EVENT_TRACER_WAIT(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eWait, instance, name)
|
||||
|
||||
// Indicate start of an event actual execution, on the timeline this will
|
||||
// change the event's tape to a deeper color, the time will show in details.
|
||||
#define MOZ_EVENT_TRACER_EXEC(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eExec, instance, name)
|
||||
|
||||
// Indicate the end of an event execution (the event has been done),
|
||||
// on the timeline this will end the event's tape and show the time in
|
||||
// event details.
|
||||
// NOTE: when the event duration is extremely short, like 1ms, it will convert
|
||||
// to an event w/o a duration - the same as MOZ_EVENT_TRACER_MARK would be used.
|
||||
#define MOZ_EVENT_TRACER_DONE(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eDone, instance, name)
|
||||
|
||||
// The same meaning as the above macros, just for concurent events.
|
||||
// Concurent event means it can happen for the same instance on more
|
||||
// then just a single thread, e.g. a service method call, a global lock
|
||||
// acquisition, enter and release.
|
||||
#define MOZ_EVENT_TRACER_WAIT_THREADSAFE(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eWait | mozilla::eventtracer::eThreadConcurrent, instance, name)
|
||||
#define MOZ_EVENT_TRACER_EXEC_THREADSAFE(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eExec | mozilla::eventtracer::eThreadConcurrent, instance, name)
|
||||
#define MOZ_EVENT_TRACER_DONE_THREASAFE(instance, name) \
|
||||
mozilla::eventtracer::Mark(mozilla::eventtracer::eDone | mozilla::eventtracer::eThreadConcurrent, instance, name)
|
||||
|
||||
#else
|
||||
|
||||
// MOZ_VISUAL_EVENT_TRACER disabled
|
||||
|
||||
#define MOZ_EVENT_TRACER_NAME_OBJECT(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_COMPOUND_NAME(instance, name, name2) (void)0
|
||||
#define MOZ_EVENT_TRACER_MARK(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_WAIT(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_EXEC(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_DONE(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_WAIT_THREADSAFE(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_EXEC_THREADSAFE(instance, name) (void)0
|
||||
#define MOZ_EVENT_TRACER_DONE_THREASAFE(instance, name) (void)0
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
namespace eventtracer {
|
||||
|
||||
// Initialize the event tracer engine, called automatically on XPCOM startup.
|
||||
void Init();
|
||||
|
||||
// Shuts the event tracer engine down and closes the log file, called
|
||||
// automatically during XPCOM shutdown.
|
||||
void Shutdown();
|
||||
|
||||
enum MarkType {
|
||||
eNone, // No operation, ignored
|
||||
eName, // This is used to bind an object instance with a name
|
||||
|
||||
eShot, // An event with no duration
|
||||
eWait, // Start of waiting for execution (lock acquire, post...)
|
||||
eExec, // Start of the execution it self
|
||||
eDone, // End of the execution
|
||||
eLast, // Sentinel
|
||||
|
||||
// Flags
|
||||
|
||||
// The same object can execute the same event on several threads concurently
|
||||
eThreadConcurrent = 0x10000
|
||||
};
|
||||
|
||||
// Records an event on the calling thread.
|
||||
// @param aType
|
||||
// One of MarkType fields, can be bitwise or'ed with the flags.
|
||||
// @param aItem
|
||||
// Reference to the object we want to bind a name to or the event is
|
||||
// happening on. Can be actually anything, but valid poitners should
|
||||
// be used.
|
||||
// @param aText
|
||||
// Text of the name (for eName) or event's name for others. The string
|
||||
// is duplicated.
|
||||
// @param aText2
|
||||
// Optional second part of the instnace name, or event name.
|
||||
// Event filtering does apply only to the first part (aText).
|
||||
void Mark(uint32_t aType, void* aItem,
|
||||
const char* aText, const char* aText2 = 0);
|
||||
|
||||
|
||||
// Helper guard object. Use to mark an event in the constructor and a different
|
||||
// event in the destructor.
|
||||
//
|
||||
// Example:
|
||||
// int class::func()
|
||||
// {
|
||||
// AutoEventTracer tracer(this, eventtracer::eExec, eventtracer::eDone, "func");
|
||||
//
|
||||
// do_something_taking_a_long_time();
|
||||
// }
|
||||
class MOZ_STACK_CLASS AutoEventTracer
|
||||
{
|
||||
public:
|
||||
AutoEventTracer(void* aInstance,
|
||||
uint32_t aTypeOn, // MarkType marked in constructor
|
||||
uint32_t aTypeOff, // MarkType marked in destructor
|
||||
const char* aName,
|
||||
const char* aName2 = 0
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
|
||||
: mInstance(aInstance)
|
||||
, mName(aName)
|
||||
, mName2(aName2)
|
||||
, mTypeOn(aTypeOn)
|
||||
, mTypeOff(aTypeOff)
|
||||
{
|
||||
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
|
||||
|
||||
::mozilla::eventtracer::Mark(mTypeOn, mInstance, mName, mName2);
|
||||
}
|
||||
|
||||
~AutoEventTracer()
|
||||
{
|
||||
::mozilla::eventtracer::Mark(mTypeOff, mInstance, mName, mName2);
|
||||
}
|
||||
|
||||
private:
|
||||
void* mInstance;
|
||||
const char* mName;
|
||||
const char* mName2;
|
||||
uint32_t mTypeOn;
|
||||
uint32_t mTypeOff;
|
||||
|
||||
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
|
||||
};
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
|
||||
// The scriptable class that drives the event tracer
|
||||
|
||||
class VisualEventTracer final: public nsIVisualEventTracer
|
||||
{
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIVISUALEVENTTRACER
|
||||
private:
|
||||
~VisualEventTracer() {}
|
||||
};
|
||||
|
||||
#define NS_VISUALEVENTTRACER_CID \
|
||||
{ 0xb9e5e102, 0xc2f4, 0x497a, \
|
||||
{ 0xa6, 0xe4, 0x54, 0xde, 0xf3, 0x71, 0xf3, 0x9d } }
|
||||
#define NS_VISUALEVENTTRACER_CONTRACTID "@mozilla.org/base/visual-event-tracer;1"
|
||||
#define NS_VISUALEVENTTRACER_CLASSNAME "Visual Event Tracer"
|
||||
|
||||
#endif
|
||||
|
||||
} // eventtracer
|
||||
} // mozilla
|
||||
|
||||
#endif /* VisualEventTracer_h___ */
|
@ -25,7 +25,6 @@ XPIDL_SOURCES += [
|
||||
'nsISupports.idl',
|
||||
'nsIUUIDGenerator.idl',
|
||||
'nsIVersionComparator.idl',
|
||||
'nsIVisualEventTracer.idl',
|
||||
'nsIWeakReference.idl',
|
||||
'nsrootidl.idl',
|
||||
]
|
||||
@ -86,7 +85,6 @@ EXPORTS.mozilla += [
|
||||
'StaticMutex.h',
|
||||
'StaticPtr.h',
|
||||
'SystemMemoryReporter.h',
|
||||
'VisualEventTracer.h',
|
||||
]
|
||||
|
||||
# nsDebugImpl isn't unified because we disable PGO so that NS_ABORT_OOM isn't
|
||||
@ -122,7 +120,6 @@ UNIFIED_SOURCES += [
|
||||
'nsTraceRefcnt.cpp',
|
||||
'nsUUIDGenerator.cpp',
|
||||
'nsVersionComparatorImpl.cpp',
|
||||
'VisualEventTracer.cpp',
|
||||
]
|
||||
|
||||
# MOZ_STACKWALKING is defined in configure.in when the build configuration meets
|
||||
|
@ -1,59 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIVisualEventTracerLog;
|
||||
|
||||
/**
|
||||
* Interface to control the visual event tracer feature. The result
|
||||
* is a log of various events that are monitored by a custom code
|
||||
* instrumentation around the mozilla code base.
|
||||
*/
|
||||
|
||||
[builtinclass, scriptable, uuid(713ee3ca-95e0-4085-8616-f6d64a9508ad)]
|
||||
interface nsIVisualEventTracer : nsISupports
|
||||
{
|
||||
/**
|
||||
* Start the logging now. No affect if already started.
|
||||
* Current backlog is deleted by this call otherwise.
|
||||
*
|
||||
* @param minBacklogSeconds
|
||||
* Manimum time to keep the backlog. Entries of the log are discarded
|
||||
* when their age is more then value of this argument.
|
||||
*/
|
||||
void start(in unsigned long minBacklogSeconds);
|
||||
|
||||
/**
|
||||
* Stop the logging now. Backlog is kept in memory.
|
||||
*/
|
||||
void stop();
|
||||
|
||||
/**
|
||||
* Obtain the log. This can be called whenever you want.
|
||||
*
|
||||
* @return
|
||||
* Result is an object that keeps snaphot of the log from
|
||||
* time this method has been called. You can then access
|
||||
* the log using the object. Calling stop() on the tracer
|
||||
* doesn't delete this log.
|
||||
*/
|
||||
nsIVisualEventTracerLog snapshot();
|
||||
};
|
||||
|
||||
[builtinclass, scriptable, uuid(8ec6e36d-6cba-400b-bcd6-454679f5f75a)]
|
||||
interface nsIVisualEventTracerLog : nsISupports
|
||||
{
|
||||
/**
|
||||
* JSON string of the log. Use JSON.parse to get it as an object.
|
||||
*/
|
||||
readonly attribute ACString JSONString;
|
||||
|
||||
/**
|
||||
* Write the JSON string returned by JSONString to the log defined by
|
||||
* the environment variable MOZ_PROFILING_FILE.
|
||||
*/
|
||||
void writeToProfilingFile();
|
||||
};
|
@ -135,10 +135,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
|
||||
|
||||
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
#include "mozilla/VisualEventTracer.h"
|
||||
#endif
|
||||
|
||||
#include "ogg/ogg.h"
|
||||
#if defined(MOZ_VPX) && !defined(MOZ_VPX_NO_MEM_REPORTING)
|
||||
#if defined(HAVE_STDINT_H)
|
||||
@ -162,9 +158,6 @@ extern nsresult nsStringInputStreamConstructor(nsISupports*, REFNSIID, void**);
|
||||
using namespace mozilla;
|
||||
using base::AtExitManager;
|
||||
using mozilla::ipc::BrowserProcessSubThread;
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
using mozilla::eventtracer::VisualEventTracer;
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
@ -216,9 +209,6 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsBinaryInputStream)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStorageStream)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsVersionComparatorImpl)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsScriptableBase64Encoder)
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(VisualEventTracer)
|
||||
#endif
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsVariant)
|
||||
|
||||
@ -758,10 +748,6 @@ NS_InitXPCOM2(nsIServiceManager** aResult,
|
||||
loop->transient_hang_timeout(),
|
||||
loop->permanent_hang_timeout());
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
mozilla::eventtracer::Init();
|
||||
#endif
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -1043,10 +1029,6 @@ ShutdownXPCOM(nsIServiceManager* aServMgr)
|
||||
|
||||
BackgroundHangMonitor::Shutdown();
|
||||
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
eventtracer::Shutdown();
|
||||
#endif
|
||||
|
||||
profiler_shutdown();
|
||||
|
||||
NS_LogTerm();
|
||||
|
@ -21,9 +21,6 @@
|
||||
COMPONENT(CONSOLESERVICE, nsConsoleServiceConstructor)
|
||||
COMPONENT(ATOMSERVICE, nsAtomServiceConstructor)
|
||||
COMPONENT(OBSERVERSERVICE, nsObserverService::Create)
|
||||
#ifdef MOZ_VISUAL_EVENT_TRACER
|
||||
COMPONENT(VISUALEVENTTRACER, VisualEventTracerConstructor)
|
||||
#endif
|
||||
|
||||
COMPONENT(TIMER, nsTimerImplConstructor)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user