Merge mozilla-central to mozilla-inbound. a=backout on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Wed, 18 Apr 2018 21:49:28 +0300
changeset 467888 fbdc3aa633bcb0619fe17168acc426ade92752a6
parent 467887 8710c034fb44a1bb177ff4d39a2b600c6de22dbf (current diff)
parent 467815 0e45c13b34e815cb42a9f08bb44142d1a81e186e (diff)
child 467889 fb5f1d08489f41235639568b5c53ab65deb752ef
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
milestone61.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge mozilla-central to mozilla-inbound. a=backout on a CLOSED TREE
dom/media/AsyncLogger.h
dom/media/Tracing.cpp
dom/media/Tracing.h
deleted file mode 100644
--- a/dom/media/AsyncLogger.h
+++ /dev/null
@@ -1,269 +0,0 @@
-/* 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/. */
-
-/* Implementation of an asynchronous lock-free logging system. */
-
-#ifndef mozilla_dom_AsyncLogger_h
-#define mozilla_dom_AsyncLogger_h
-
-#include <atomic>
-#include <thread>
-#include "mozilla/Logging.h"
-#include "mozilla/Attributes.h"
-#include "mozilla/MathAlgorithms.h"
-#include "mozilla/Sprintf.h"
-
-namespace mozilla {
-
-namespace detail {
-
- // This class implements a lock-free multiple producer single consumer queue of
- // fixed size log messages, with the following characteristics:
- // - Unbounded (uses a intrinsic linked list)
- // - Allocates on Push. Push can be called on any thread.
- // - Deallocates on Pop. Pop MUST always be called on the same thread for the
- // life-time of the queue.
- //
- // In our scenario, the producer threads are real-time, they can't block. The
- // consummer thread runs every now and then and empties the queue to a log
- // file, on disk.
- //
- // Having fixed size messages and jemalloc is probably not the fastest, but
- // allows having a simpler design, we count on the fact that jemalloc will get
- // the memory from a thread-local source most of the time.
-template<size_t MESSAGE_LENGTH>
-class MPSCQueue
-{
-public:
-    struct Message {
-        Message()
-        {
-           mNext.store(nullptr, std::memory_order_relaxed);
-        }
-        Message(const Message& aMessage) = delete;
-        void operator=(const Message& aMessage) = delete;
-
-        char data[MESSAGE_LENGTH];
-        std::atomic<Message*> mNext;
-    };
-    // Creates a new MPSCQueue. Initially, the queue has a single sentinel node,
-    // pointed to by both mHead and mTail.
-    MPSCQueue()
-    // At construction, the initial message points to nullptr (it has no
-    // successor). It is a sentinel node, that does not contain meaningful
-    // data.
-    : mHead(new Message())
-    , mTail(mHead.load(std::memory_order_relaxed))
-    { }
-
-    ~MPSCQueue()
-    {
-        Message dummy;
-        while (this->Pop(dummy.data)) {}
-        Message* front = mHead.load(std::memory_order_relaxed);
-        delete front;
-    }
-
-    void
-    Push(MPSCQueue<MESSAGE_LENGTH>::Message* aMessage)
-    {
-        // The next two non-commented line are called A and B in this paragraph.
-        // Producer threads i, i-1, etc. are numbered in the order they reached
-        // A in time, thread i being the thread that has reached A first.
-        // Atomically, on line A the new `mHead` is set to be the node that was
-        // just allocated, with strong memory order. From now one, any thread
-        // that reaches A will see that the node just allocated is
-        // effectively the head of the list, and will make itself the new head
-        // of the list.
-        // In a bad case (when thread i executes A and then
-        // is not scheduled for a long time), it is possible that thread i-1 and
-        // subsequent threads create a seemingly disconnected set of nodes, but
-        // they all have the correct value for the next node to set as their
-        // mNext member on their respective stacks (in `prev`), and this is
-        // always correct. When the scheduler resumes, and line B is executed,
-        // the correct linkage is resumed.
-        // Before line B, since mNext for the node the was the last element of
-        // the queue still has an mNext of nullptr, Pop will not see the node
-        // added.
-        // For line A, it's critical to have strong ordering both ways (since
-        // it's going to possibly be read and write repeatidly by multiple
-        // threads)
-        // Line B can have weaker guarantees, it's only going to be written by a
-        // single thread, and we just need to ensure it's read properly by a
-        // single other one.
-        Message* prev = mHead.exchange(aMessage, std::memory_order_acq_rel);
-        prev->mNext.store(aMessage, std::memory_order_release);
-    }
-
-    // Allocates a new node, copy aInput to the new memory location, and pushes
-    // it to the end of the list.
-    void
-    Push(const char aInput[MESSAGE_LENGTH])
-    {
-        // Create a new message, and copy the messages passed on argument to the
-        // new memory location. We are not touching the queue right now. The
-        // successor for this new node is set to be nullptr.
-        Message* msg = new Message();
-        strncpy(msg->data, aInput, MESSAGE_LENGTH);
-
-        Push(msg);
-    }
-
-    // Copy the content of the first message of the queue to aOutput, and
-    // frees the message. Returns true if there was a message, in which case
-    // `aOutput` contains a valid value. If the queue was empty, returns false,
-    // in which case `aOutput` is left untouched.
-    bool
-    Pop(char aOutput[MESSAGE_LENGTH])
-    {
-        // Similarly, in this paragraph, the two following lines are called A
-        // and B, and threads are called thread i, i-1, etc. in order of
-        // execution of line A.
-        // On line A, the first element of the queue is acquired. It is simply a
-        // sentinel node.
-        // On line B, we acquire the node that has the data we want. If B is
-        // null, then only the sentinel node was present in the queue, we can
-        // safely return false.
-        // mTail can be loaded with relaxed ordering, since it's not written nor
-        // read by any other thread (this queue is single consumer).
-        // mNext can be written to by one of the producer, so it's necessary to
-        // ensure those writes are seen, hence the stricter ordering.
-        Message* tail = mTail.load(std::memory_order_relaxed);
-        Message* next = tail->mNext.load(std::memory_order_acquire);
-
-        if (next == nullptr) {
-            return false;
-        }
-
-        strncpy(aOutput, next->data, MESSAGE_LENGTH);
-
-        // Simply shift the queue one node further, so that the sentinel node is
-        // now pointing to the correct most ancient node. It contains stale data,
-        // but this data will never be read again.
-        // It's only necessary to ensure the previous load on this thread is not
-        // reordered past this line, so release ordering is sufficient here.
-        mTail.store(next, std::memory_order_release);
-
-        // This thread is now the only thing that points to `tail`, it can be
-        // safely deleted.
-        delete tail;
-
-        return true;
-    }
-
-private:
-    // An atomic pointer to the most recent message in the queue.
-    std::atomic<Message*> mHead;
-    // An atomic pointer to a sentinel node, that points to the oldest message
-    // in the queue.
-    std::atomic<Message*> mTail;
-
-    MPSCQueue(const MPSCQueue&) = delete;
-    void operator=(const MPSCQueue&) = delete;
-public:
-    // The goal here is to make it easy on the allocator. We pack a pointer in the
-    // message struct, and we still want to do power of two allocations to
-    // minimize allocator slop. The allocation size are going to be constant, so
-    // the allocation is probably going to hit the thread local cache in jemalloc,
-    // making it cheap and, more importantly, lock-free enough.
-    static const size_t MESSAGE_PADDING = sizeof(Message::mNext);
-private:
-    static_assert(IsPowerOfTwo(MESSAGE_LENGTH + MESSAGE_PADDING),
-                  "MPSCQueue internal allocations must have a size that is a"
-                  "power of two ");
-};
-} // end namespace detail
-
-// This class implements a lock-free asynchronous logger, that outputs to
-// MOZ_LOG.
-// Any thread can use this logger without external synchronization and without
-// being blocked. This log is suitable for use in real-time audio threads.
-// Log formatting is best done externally, this class implements the output
-// mechanism only.
-// This class uses a thread internally, and must be started and stopped
-// manually.
-// If logging is disabled, all the calls are no-op.
-class AsyncLogger
-{
-public:
-  static const uint32_t MAX_MESSAGE_LENGTH = 512 - detail::MPSCQueue<sizeof(void*)>::MESSAGE_PADDING;
-
-  // aLogModuleName is the name of the MOZ_LOG module.
-  explicit AsyncLogger(const char* aLogModuleName)
-  : mThread(nullptr)
-  , mLogModule(aLogModuleName)
-  , mRunning(false)
-  { }
-
-  ~AsyncLogger()
-  {
-    if (Enabled()) {
-      Stop();
-    }
-  }
-
-  void Start()
-  {
-    MOZ_ASSERT(!mRunning, "Double calls to AsyncLogger::Start");
-    if (Enabled()) {
-      mRunning = true;
-      Run();
-    }
-  }
-
-  void Stop()
-  {
-    if (Enabled()) {
-      if (mRunning) {
-        mRunning = false;
-        mThread->join();
-      }
-    } else {
-      MOZ_ASSERT(!mRunning && !mThread);
-    }
-  }
-
-  void Log(const char* format, ...) MOZ_FORMAT_PRINTF(2,3)
-  {
-    if (Enabled()) {
-      auto* msg = new detail::MPSCQueue<MAX_MESSAGE_LENGTH>::Message();
-      va_list args;
-      va_start(args, format);
-      VsprintfLiteral(msg->data, format, args);
-      va_end(args);
-      mMessageQueue.Push(msg);
-    }
-  }
-
-  bool Enabled()
-  {
-    return MOZ_LOG_TEST(mLogModule, mozilla::LogLevel::Verbose);
-  }
-
-private:
-  void Run()
-  {
-    MOZ_ASSERT(Enabled());
-    mThread.reset(new std::thread([this]() {
-      while (mRunning) {
-        char message[MAX_MESSAGE_LENGTH];
-        while (mMessageQueue.Pop(message) && mRunning) {
-          MOZ_LOG(mLogModule, mozilla::LogLevel::Verbose, ("%s", message));
-        }
-        Sleep();
-      }
-    }));
-  }
-
-  void Sleep() { std::this_thread::sleep_for(std::chrono::milliseconds(10)); }
-
-  std::unique_ptr<std::thread> mThread;
-  mozilla::LazyLogModule mLogModule;
-  detail::MPSCQueue<MAX_MESSAGE_LENGTH> mMessageQueue;
-  std::atomic<bool> mRunning;
-};
-
-} // end namespace mozilla
-
-#endif // mozilla_dom_AsyncLogger_h
--- a/dom/media/GraphDriver.cpp
+++ b/dom/media/GraphDriver.cpp
@@ -1,21 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; 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 <MediaStreamGraphImpl.h>
 #include "mozilla/dom/AudioContext.h"
 #include "mozilla/SharedThreadPool.h"
 #include "mozilla/ClearOnShutdown.h"
 #include "mozilla/Unused.h"
 #include "CubebUtils.h"
-#include "Tracing.h"
 
 #ifdef MOZ_WEBRTC
 #include "webrtc/MediaEngineWebRTC.h"
 #endif
 
 #ifdef XP_MACOSX
 #include <sys/sysctl.h>
 #endif
@@ -878,19 +876,16 @@ AudioCallbackDriver::AutoInCallback::Aut
 AudioCallbackDriver::AutoInCallback::~AutoInCallback() {
   mDriver->mInCallback = false;
 }
 
 long
 AudioCallbackDriver::DataCallback(const AudioDataValue* aInputBuffer,
                                   AudioDataValue* aOutputBuffer, long aFrames)
 {
-   TRACE_AUDIO_CALLBACK_BUDGET(aFrames, mSampleRate);
-   TRACE_AUDIO_CALLBACK();
-
   // Don't add the callback until we're inited and ready
   if (!mAddedMixer) {
     mGraphImpl->mMixer.AddCallback(this);
     mAddedMixer = true;
   }
 
 #ifdef DEBUG
   // DebugOnly<> doesn't work here... it forces an initialization that will cause
--- a/dom/media/MediaStreamGraph.cpp
+++ b/dom/media/MediaStreamGraph.cpp
@@ -27,28 +27,25 @@
 #include "mozilla/media/MediaUtils.h"
 #include <algorithm>
 #include "GeckoProfiler.h"
 #include "VideoFrameContainer.h"
 #include "mozilla/AbstractThread.h"
 #include "mozilla/Unused.h"
 #include "mtransport/runnable_utils.h"
 #include "VideoUtils.h"
-#include "Tracing.h"
 
 #include "webaudio/blink/DenormalDisabler.h"
 #include "webaudio/blink/HRTFDatabaseLoader.h"
 
 using namespace mozilla::layers;
 using namespace mozilla::dom;
 using namespace mozilla::gfx;
 using namespace mozilla::media;
 
-mozilla::AsyncLogger gMSGTraceLogger("MSGTracing");
-
 namespace mozilla {
 
 LazyLogModule gMediaStreamGraphLog("MediaStreamGraph");
 #ifdef LOG
 #undef LOG
 #endif // LOG
 #define LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg)
 
@@ -66,20 +63,16 @@ enum SourceMediaStream::TrackCommands : 
 static nsDataHashtable<nsUint32HashKey, MediaStreamGraphImpl*> gGraphs;
 
 MediaStreamGraphImpl::~MediaStreamGraphImpl()
 {
   MOZ_ASSERT(mStreams.IsEmpty() && mSuspendedStreams.IsEmpty(),
              "All streams should have been destroyed by messages from the main thread");
   LOG(LogLevel::Debug, ("MediaStreamGraph %p destroyed", this));
   LOG(LogLevel::Debug, ("MediaStreamGraphImpl::~MediaStreamGraphImpl"));
-
-#ifdef TRACING
-  gMSGTraceLogger.Stop();
-#endif
 }
 
 void
 MediaStreamGraphImpl::AddStreamGraphThread(MediaStream* aStream)
 {
   MOZ_ASSERT(OnGraphThreadOrNotRunning());
   aStream->mTracksStartTime = mProcessedTime;
 
@@ -1124,17 +1117,16 @@ MediaStreamGraphImpl::RunMessageAfterPro
   // Only one block is used for messages from the graph thread.
   MOZ_ASSERT(mFrontMessageQueue.Length() == 1);
   mFrontMessageQueue[0].mMessages.AppendElement(Move(aMessage));
 }
 
 void
 MediaStreamGraphImpl::RunMessagesInQueue()
 {
-  TRACE_AUDIO_CALLBACK();
   MOZ_ASSERT(OnGraphThread());
   // Calculate independent action times for each batch of messages (each
   // batch corresponding to an event loop task). This isolates the performance
   // of different scripts to some extent.
   for (uint32_t i = 0; i < mFrontMessageQueue.Length(); ++i) {
     nsTArray<UniquePtr<ControlMessage>>& messages = mFrontMessageQueue[i].mMessages;
 
     for (uint32_t j = 0; j < messages.Length(); ++j) {
@@ -1142,17 +1134,16 @@ MediaStreamGraphImpl::RunMessagesInQueue
     }
   }
   mFrontMessageQueue.Clear();
 }
 
 void
 MediaStreamGraphImpl::UpdateGraph(GraphTime aEndBlockingDecisions)
 {
-  TRACE_AUDIO_CALLBACK();
   MOZ_ASSERT(OnGraphThread());
   MOZ_ASSERT(aEndBlockingDecisions >= mProcessedTime);
   // The next state computed time can be the same as the previous: it
   // means the driver would have been blocking indefinitly, but the graph has
   // been woken up right after having been to sleep.
   MOZ_ASSERT(aEndBlockingDecisions >= mStateComputedTime);
 
   UpdateStreamOrder();
@@ -1238,17 +1229,16 @@ MediaStreamGraphImpl::UpdateGraph(GraphT
       aEndBlockingDecisions == mStateComputedTime) {
     EnsureNextIteration();
   }
 }
 
 void
 MediaStreamGraphImpl::Process()
 {
-  TRACE_AUDIO_CALLBACK();
   MOZ_ASSERT(OnGraphThread());
   // Play stream contents.
   bool allBlockedForever = true;
   // True when we've done ProcessInput for all processed streams.
   bool doneAllProducing = false;
   // This is the number of frame that are written to the AudioStreams, for
   // this cycle.
   StreamTime ticksPlayed = 0;
@@ -1343,17 +1333,16 @@ MediaStreamGraphImpl::UpdateMainThreadSt
 
   SwapMessageQueues();
   return true;
 }
 
 bool
 MediaStreamGraphImpl::OneIteration(GraphTime aStateEnd)
 {
-  TRACE_AUDIO_CALLBACK();
   // Changes to LIFECYCLE_RUNNING occur before starting or reviving the graph
   // thread, and so the monitor need not be held to check mLifecycleState.
   // LIFECYCLE_THREAD_NOT_STARTED is possible when shutting down offline
   // graphs that have not started.
   MOZ_DIAGNOSTIC_ASSERT(mLifecycleState <= LIFECYCLE_RUNNING);
   MOZ_ASSERT(OnGraphThread());
   WebCore::DenormalDisabler disabler;
 
@@ -1550,17 +1539,16 @@ public:
                                                bool aSourceIsMSG)
     : Runnable("MediaStreamGraphStableStateRunnable")
     , mGraph(aGraph)
     , mSourceIsMSG(aSourceIsMSG)
   {
   }
   NS_IMETHOD Run() override
   {
-    TRACE();
     if (mGraph) {
       mGraph->RunInStableState(mSourceIsMSG);
     }
     return NS_OK;
   }
 private:
   RefPtr<MediaStreamGraphImpl> mGraph;
   bool mSourceIsMSG;
@@ -2772,17 +2760,16 @@ SourceMediaStream::SetPullEnabled(bool a
   GraphImpl()->AppendMessage(MakeUnique<Message>(this, aEnabled));
 }
 
 bool
 SourceMediaStream::PullNewData(
   StreamTime aDesiredUpToTime,
   nsTArray<RefPtr<SourceMediaStream::NotifyPullPromise>>& aPromises)
 {
-  TRACE_AUDIO_CALLBACK();
   MutexAutoLock lock(mMutex);
   if (!mPullEnabled || mFinished) {
     return false;
   }
   // Compute how much stream time we'll need assuming we don't block
   // the stream at all.
   StreamTime t = GraphTimeToStreamTime(aDesiredUpToTime);
   StreamTime current = mTracks.GetEnd();
@@ -3622,22 +3609,16 @@ MediaStreamGraphImpl::MediaStreamGraphIm
 {
   if (mRealtime) {
     if (aDriverRequested == AUDIO_THREAD_DRIVER) {
       AudioCallbackDriver* driver = new AudioCallbackDriver(this);
       mDriver = driver;
     } else {
       mDriver = new SystemClockDriver(this);
     }
-
-#ifdef TRACING
-    // This is a noop if the logger has not been enabled.
-    gMSGTraceLogger.Start();
-    gMSGTraceLogger.Log("[");
-#endif
   } else {
     mDriver = new OfflineClockDriver(this, MEDIA_GRAPH_TARGET_PERIOD_MS);
   }
 
   mLastMainThreadUpdate = TimeStamp::Now();
 
   RegisterWeakAsyncMemoryReporter(this);
 }
--- a/dom/media/MediaStreamGraph.h
+++ b/dom/media/MediaStreamGraph.h
@@ -20,23 +20,16 @@
 #include "nsIRunnable.h"
 #include "nsTArray.h"
 #include <speex/speex_resampler.h>
 
 class nsIRunnable;
 class nsIGlobalObject;
 class nsPIDOMWindowInner;
 
-namespace mozilla {
-  class AsyncLogger;
-};
-
-extern mozilla::AsyncLogger gMSGTraceLogger;
-
-
 template <>
 class nsAutoRefTraits<SpeexResamplerState> : public nsPointerRefTraits<SpeexResamplerState>
 {
   public:
   static void Release(SpeexResamplerState* aState) { speex_resampler_destroy(aState); }
 };
 
 namespace mozilla {
--- a/dom/media/MediaStreamGraphImpl.h
+++ b/dom/media/MediaStreamGraphImpl.h
@@ -18,17 +18,16 @@
 #include "mozilla/UniquePtr.h"
 #include "mozilla/WeakPtr.h"
 #include "nsDataHashtable.h"
 #include "nsIMemoryReporter.h"
 #include "nsINamed.h"
 #include "nsIRunnable.h"
 #include "nsIThread.h"
 #include "nsITimer.h"
-#include "AsyncLogger.h"
 
 namespace mozilla {
 
 namespace media {
 class ShutdownTicket;
 }
 
 template <typename T>
deleted file mode 100644
--- a/dom/media/Tracing.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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 "Tracing.h"
-
-#include <inttypes.h>
-#include <cstdio>
-
-#include "AsyncLogger.h"
-#include "mozilla/TimeStamp.h"
-
-using namespace mozilla;
-
-uint64_t
-AutoTracer::NowInUs()
-{
-  static TimeStamp base = TimeStamp::Now();
-  return (TimeStamp::Now() - base).ToMicroseconds();
-}
-
-void
-AutoTracer::PrintEvent(const char* aName,
-                       const char* aCategory,
-                       const char* aComment,
-                       TracingPhase aPhase,
-                       uint64_t aTime,
-                       uint64_t aPID,
-                       uint64_t aThread)
-{
-  mLogger.Log("{\"name\": \"%s\", \"cat\": \"%s\", \"ph\": \"%c\","
-              "\"ts\": %" PRIu64 ", \"pid\": %" PRIu64 ", \"tid\":"
-              " %" PRIu64 ", \"args\": { \"comment\": \"%s\"}},",
-           aName, aCategory, TRACING_PHASE_STRINGS[static_cast<int>(aPhase)],
-           aTime, aPID, aThread, aComment);
-}
-
-void
-AutoTracer::PrintBudget(const char* aName,
-                        const char* aCategory,
-                        const char* aComment,
-                        uint64_t aDuration,
-                        uint64_t aPID,
-                        uint64_t aThread,
-                        uint64_t aFrames)
-{
-  mLogger.Log("{\"name\": \"%s\", \"cat\": \"%s\", \"ph\": \"X\","
-              "\"ts\": %" PRIu64 ", \"dur\": %" PRIu64 ", \"pid\": %" PRIu64 ","
-              "\"tid\": %" PRIu64 ", \"args\": { \"comment\": %" PRIu64 "}},",
-              aName, aCategory, NowInUs(), aDuration, aPID, aThread, aFrames);
-}
-
-AutoTracer::AutoTracer(AsyncLogger& aLogger,
-                       const char* aLocation,
-                       uint64_t aPID,
-                       uint64_t aTID,
-                       EventType aEventType,
-                       uint64_t aFrames,
-                       uint64_t aSampleRate)
-  : mLogger(aLogger)
-  , mLocation(aLocation)
-  , mEventType(aEventType)
-  , mPID(aPID)
-  , mTID(aTID)
-{
-  MOZ_ASSERT(aEventType == EventType::BUDGET);
-
-  float durationUS = (static_cast<float>(aFrames) / aSampleRate) * 1e6;
-  PrintBudget(aLocation, "perf", mComment, durationUS, mPID, mTID, aFrames);
-}
-
-AutoTracer::AutoTracer(AsyncLogger& aLogger,
-                       const char* aLocation,
-                       uint64_t aPID,
-                       uint64_t aTID,
-                       EventType aEventType,
-                       const char* aComment)
-  : mLogger(aLogger)
-  , mLocation(aLocation)
-  , mComment(aComment)
-  , mEventType(aEventType)
-  , mPID(aPID)
-  , mTID(aTID)
-{
-  MOZ_ASSERT(aEventType == EventType::DURATION);
-  PrintEvent(aLocation, "perf", mComment, TracingPhase::BEGIN, NowInUs(), aPID, aTID);
-}
-
-AutoTracer::~AutoTracer()
-{
-  if (mEventType == EventType::DURATION) {
-    PrintEvent(mLocation, "perf", mComment, TracingPhase::END, NowInUs(), mPID, mTID);
-  }
-}
deleted file mode 100644
--- a/dom/media/Tracing.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; 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/. */
-
-#ifndef TRACING_H
-#define TRACING_H
-
-#include <cstdint>
-
-#include "AsyncLogger.h"
-
-#include <mozilla/Attributes.h>
-
-#if defined(_WIN32)
-#include <process.h>
-#define getpid() _getpid()
-#else
-#include <unistd.h>
-#endif
-
-#if defined(_MSC_VER)
-// MSVC
-#define FUNCTION_SIGNATURE  __FUNCSIG__
-#elif defined(__GNUC__)
-// gcc, clang
-#define FUNCTION_SIGNATURE __PRETTY_FUNCTION__
-#endif
-
-#ifdef TRACING
-  /* TRACE is for use in the real-time audio rendering thread.
-   * It would be better to always pass in the thread id. However, the thread an
-   * audio callback runs on can change when the underlying audio device change,
-   * and also it seems to be called from a thread pool in a round-robin fashion
-   * when audio remoting is activated, making the traces unreadable.
-   * The thread on which the AudioCallbackDriver::DataCallback is to always
-   * be thread 0, and the budget is set to always be thread 1. This allows
-   * displaying those elements in two separate lanes.
-   * The other thread have "normal" tid. Hashing allows being able to get a
-   * string representation that is unique and guaranteed to be portable. */
-  #define TRACE_AUDIO_CALLBACK()                                               \
-    AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(), 0);
-  #define TRACE_AUDIO_CALLBACK_BUDGET(aFrames, aSampleRate)                    \
-    AutoTracer budget(gMSGTraceLogger, "Real-time budget", getpid(), 1,        \
-                      AutoTracer::EventType::BUDGET, aFrames, aSampleRate);
-  #define TRACE()                                                              \
-    AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(),            \
-                     std::hash<std::thread::id>{}(std::this_thread::get_id()));
-  #define TRACE_COMMENT(aComment)                                              \
-    AutoTracer trace(gMSGTraceLogger, FUNCTION_SIGNATURE, getpid(),            \
-                     std::hash<std::thread::id>{}(std::this_thread::get_id()), \
-                     AutoTracer::EventType::DURATION,                          \
-                     aComment);
-#else
-  #define TRACE_AUDIO_CALLBACK()
-  #define TRACE_AUDIO_CALLBACK_BUDGET(aFrames, aSampleRate)
-  #define TRACE()
-  #define TRACE_COMMENT(aComment)
-#endif
-
-class MOZ_RAII AutoTracer
-{
-public:
-  enum class EventType
-  {
-    DURATION,
-    BUDGET
-  };
-
-  AutoTracer(mozilla::AsyncLogger& aLogger,
-             const char* aLocation,
-             uint64_t aPID,
-             uint64_t aTID,
-             EventType aEventType = EventType::DURATION,
-             const char* aComment = nullptr);
-  AutoTracer(mozilla::AsyncLogger& aLogger,
-             const char* aLocation,
-             uint64_t aPID,
-             uint64_t aTID,
-             EventType aEventType,
-             uint64_t aSampleRate,
-             uint64_t aFrames);
-  ~AutoTracer();
-private:
-  uint64_t NowInUs();
-
-  enum class TracingPhase
-  {
-    BEGIN,
-    END,
-    COMPLETE
-  };
-
-  const char TRACING_PHASE_STRINGS[3] = {
-    'B',
-    'E',
-    'X'
-  };
-
-  void PrintEvent(const char* aName,
-                  const char* aCategory,
-                  const char* aComment,
-                  TracingPhase aPhase,
-                  uint64_t aTime,
-                  uint64_t aPID,
-                  uint64_t aThread);
-
-  void PrintBudget(const char* aName,
-                   const char* aCategory,
-                   const char* aComment,
-                   uint64_t aDuration,
-                   uint64_t aPID,
-                   uint64_t aThread,
-                   uint64_t aFrames);
-
-  // The logger to use. It musdt have a lifetime longer than the block an
-  // instance of this class traces.
-  mozilla::AsyncLogger& mLogger;
-  // The location for this trace point, arbitrary string literal, often the
-  // name of the calling function, with a static lifetime.
-  const char* mLocation;
-  // A comment for this trace point, abitrary string literal with a static
-  // lifetime.
-  const char* mComment;
-  // The event type, for now either a budget or a duration.
-  const EventType mEventType;
-  // The process ID of the calling process. Traces are grouped by PID in the
-  // vizualizer.
-  const uint64_t mPID;
-  // The thread ID of the calling thread, will be displayed in a separate
-  // section in the trace visualizer.
-  const uint64_t mTID;
-};
-
-#if defined(_WIN32)
-#undef getpid
-#endif
-
-#endif /* TRACING_H */
--- a/dom/media/TrackUnionStream.cpp
+++ b/dom/media/TrackUnionStream.cpp
@@ -63,17 +63,16 @@ TrackUnionStream::TrackUnionStream()
         EndTrack(i);
         mTrackMap.RemoveElementAt(i);
       }
     }
     ProcessedMediaStream::RemoveInput(aPort);
   }
   void TrackUnionStream::ProcessInput(GraphTime aFrom, GraphTime aTo, uint32_t aFlags)
   {
-    TRACE();
     if (IsFinishedOnGraphThread()) {
       return;
     }
     AutoTArray<bool,8> mappedTracksFinished;
     AutoTArray<bool,8> mappedTracksWithMatchingInputTracks;
     for (uint32_t i = 0; i < mTrackMap.Length(); ++i) {
       mappedTracksFinished.AppendElement(true);
       mappedTracksWithMatchingInputTracks.AppendElement(false);
--- a/dom/media/moz.build
+++ b/dom/media/moz.build
@@ -84,17 +84,16 @@ XPIDL_SOURCES += [
     'nsIMediaManager.idl',
 ]
 
 XPIDL_MODULE = 'dom_media'
 
 EXPORTS += [
     'ADTSDecoder.h',
     'ADTSDemuxer.h',
-    'AsyncLogger.h',
     'AudioBufferUtils.h',
     'AudioChannelFormat.h',
     'AudioCompactor.h',
     'AudioConfig.h',
     'AudioConverter.h',
     'AudioMixer.h',
     'AudioPacketizer.h',
     'AudioSampleFormat.h',
@@ -149,17 +148,16 @@ EXPORTS += [
     'QueueObject.h',
     'SeekJob.h',
     'SeekTarget.h',
     'SelfRef.h',
     'SharedBuffer.h',
     'StreamTracks.h',
     'ThreadPoolCOMListener.h',
     'TimeUnits.h',
-    'Tracing.h',
     'TrackID.h',
     'TrackUnionStream.h',
     'VideoFrameContainer.h',
     'VideoLimits.h',
     'VideoSegment.h',
     'VideoUtils.h',
     'VorbisUtils.h',
     'XiphExtradata.h',
@@ -260,17 +258,16 @@ UNIFIED_SOURCES += [
     'ReaderProxy.cpp',
     'SeekJob.cpp',
     'StreamTracks.cpp',
     'TextTrack.cpp',
     'TextTrackCue.cpp',
     'TextTrackCueList.cpp',
     'TextTrackList.cpp',
     'TextTrackRegion.cpp',
-    'Tracing.cpp',
     'TrackUnionStream.cpp',
     'VideoFrameContainer.cpp',
     'VideoPlaybackQuality.cpp',
     'VideoSegment.cpp',
     'VideoStreamTrack.cpp',
     'VideoTrack.cpp',
     'VideoTrackList.cpp',
     'VideoUtils.cpp',
@@ -324,17 +321,16 @@ LOCAL_INCLUDES += [
 
 if CONFIG['MOZ_WEBRTC']:
     LOCAL_INCLUDES += [
         '/media/webrtc/signaling/src/common',
         '/media/webrtc/trunk',
     ]
 
 DEFINES['MOZILLA_INTERNAL_API'] = True
-DEFINES['TRACING'] = True
 
 if CONFIG['MOZ_ANDROID_HLS_SUPPORT']:
     DEFINES['MOZ_ANDROID_HLS_SUPPORT'] = True
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 # Suppress some GCC warnings being treated as errors:
 #  - about attributes on forward declarations for types that are already
--- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
+++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp
@@ -12,17 +12,16 @@
 #include "AudioConverter.h"
 #include "MediaManager.h"
 #include "MediaStreamGraphImpl.h"
 #include "MediaTrackConstraints.h"
 #include "mozilla/Assertions.h"
 #include "mozilla/ErrorNames.h"
 #include "mtransport/runnable_utils.h"
 #include "nsAutoPtr.h"
-#include "Tracing.h"
 
 // scoped_ptr.h uses FF
 #ifdef FF
 #undef FF
 #endif
 #include "webrtc/modules/audio_device/opensl/single_rw_fifo.h"
 #include "webrtc/voice_engine/voice_engine_defines.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
@@ -1179,17 +1178,16 @@ MediaEngineWebRTCMicrophoneSource::Inser
 // Note this can be called back after ::Shutdown()
 void
 MediaEngineWebRTCMicrophoneSource::NotifyInputData(MediaStreamGraph* aGraph,
                                                    const AudioDataValue* aBuffer,
                                                    size_t aFrames,
                                                    TrackRate aRate,
                                                    uint32_t aChannels)
 {
-  TRACE_AUDIO_CALLBACK();
   // If some processing is necessary, packetize and insert in the WebRTC.org
   // code. Otherwise, directly insert the mic data in the MSG, bypassing all processing.
   if (PassThrough()) {
     InsertInGraph<AudioDataValue>(aBuffer, aFrames, aChannels);
   } else {
     PacketizeAndProcess(aGraph, aBuffer, aFrames, aRate, aChannels);
   }
 }
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -45,17 +45,16 @@
 #include "nsThreadUtils.h"
 #include "nspr.h"
 #include "runnable_utils.h"
 #include "srtp.h"
 #include "transportflow.h"
 #include "transportlayer.h"
 #include "transportlayerdtls.h"
 #include "transportlayerice.h"
-#include "Tracing.h"
 
 #include "webrtc/base/bind.h"
 #include "webrtc/base/keep_ref_until_done.h"
 #include "webrtc/common_types.h"
 #include "webrtc/common_video/include/i420_buffer_pool.h"
 #include "webrtc/common_video/include/video_frame_buffer.h"
 #include "webrtc/common_video/libyuv/include/webrtc_libyuv.h"
 
@@ -1927,23 +1926,22 @@ MediaPipelineTransmit::PipelineListener:
     LOGTAG,
     "MediaPipeline::NotifyRealtimeTrackData() listener=%p, offset=%" PRId64
     ", duration=%" PRId64,
     this,
     aOffset,
     aMedia.GetDuration());
 
   if (aMedia.GetType() == MediaSegment::VIDEO) {
-    TRACE_COMMENT("Video");
     // We have to call the upstream NotifyRealtimeTrackData and
     // MediaStreamVideoSink will route them to SetCurrentFrames.
     MediaStreamVideoSink::NotifyRealtimeTrackData(aGraph, aOffset, aMedia);
     return;
   }
-  TRACE_COMMENT("Audio");
+
   NewData(aMedia, aGraph->GraphRate());
 }
 
 void
 MediaPipelineTransmit::PipelineListener::NotifyQueuedChanges(
   MediaStreamGraph* aGraph,
   StreamTime aOffset,
   const MediaSegment& aQueuedMedia)
@@ -2019,17 +2017,16 @@ MediaPipelineTransmit::PipelineListener:
 
     const AudioSegment* audio = static_cast<const AudioSegment*>(&aMedia);
     for (AudioSegment::ConstChunkIterator iter(*audio); !iter.IsEnded();
          iter.Next()) {
       mAudioProcessing->QueueAudioChunk(aRate, *iter, mEnabled);
     }
   } else {
     const VideoSegment* video = static_cast<const VideoSegment*>(&aMedia);
-
     for (VideoSegment::ConstChunkIterator iter(*video); !iter.IsEnded();
          iter.Next()) {
       mConverter->QueueVideoChunk(*iter, !mEnabled);
     }
   }
 }
 
 void
@@ -2232,17 +2229,16 @@ private:
   ~PipelineListener()
   {
     NS_ReleaseOnMainThreadSystemGroup("MediaPipeline::mConduit",
                                       mConduit.forget());
   }
 
   void NotifyPullImpl(StreamTime aDesiredTime)
   {
-    TRACE();
     uint32_t samplesPer10ms = mRate / 100;
 
     // mSource's rate is not necessarily the same as the graph rate, since there
     // are sample-rate constraints on the inbound audio: only 16, 32, 44.1 and
     // 48kHz are supported. The audio frames we get here is going to be
     // resampled when inserted into the graph.
     TrackTicks desired = mSource->TimeToTicksRoundUp(mRate, aDesiredTime);
     TrackTicks framesNeeded = desired - mPlayedTicks;