Edit

kc3-lang/angle/src/libANGLE/LoggingAnnotator.cpp

Branch :

  • Show log

    Commit

  • Author : Tobin Ehlis
    Date : 2018-05-03 11:10:44
    Hash : 573f76b3
    Message : Debug: Add Systrace Markers Update ScopedPerfEventHelper class to add systrace markers by default. This change unifies ANGLE EVENT* macro system so that at the base level in LoggingAnnotator class, systrace markers will be added by default. Modify the base DebugLogger to use char* by default and move any conversions to wchar_t to the Windows specializations where wchar is used. This limits type conversions to only where they're needed. This change also includes some new TRACE_EVENT() calls in the VK backend which will result in systrace markers for those calls on the Android platform. The new build flag "angle_enable_trace" is added to enable the tracing calls. Bug: angleproject:2528 Change-Id: Icefc197d4407e1cd31338710e37865abae6a0b15 Reviewed-on: https://chromium-review.googlesource.com/c/1042785 Commit-Queue: Tobin Ehlis <tobine@google.com> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jamie Madill <jmadill@chromium.org> Reviewed-by: Yuly Novikov <ynovikov@chromium.org>

  • src/libANGLE/LoggingAnnotator.cpp
  • //
    // Copyright 2017 The ANGLE Project Authors. All rights reserved.
    // Use of this source code is governed by a BSD-style license that can be
    // found in the LICENSE file.
    //
    // LoggingAnnotator.cpp: DebugAnnotator implementing logging
    //
    
    #include "libANGLE/LoggingAnnotator.h"
    
    #include <platform/Platform.h>
    #include "third_party/trace_event/trace_event.h"
    
    namespace angle
    {
    
    bool LoggingAnnotator::getStatus()
    {
        return false;
    }
    
    void LoggingAnnotator::beginEvent(const char *eventName, const char *eventMessage)
    {
        TRACE_EVENT_BEGIN0("gpu.angle", eventName);
    }
    
    void LoggingAnnotator::endEvent(const char *eventName)
    {
        TRACE_EVENT_END0("gpu.angle", eventName);
    }
    
    void LoggingAnnotator::setMarker(const char *markerName)
    {
        TRACE_EVENT_INSTANT0("gpu.angle", markerName);
    }
    
    void LoggingAnnotator::logMessage(const gl::LogMessage &msg) const
    {
        auto *plat = ANGLEPlatformCurrent();
        if (plat != nullptr)
        {
            switch (msg.getSeverity())
            {
                case gl::LOG_ERR:
                    plat->logError(plat, msg.getMessage().c_str());
                    break;
                case gl::LOG_WARN:
                    plat->logWarning(plat, msg.getMessage().c_str());
                    break;
                default:
                    UNREACHABLE();
            }
        }
        else
        {
            gl::Trace(msg.getSeverity(), msg.getMessage().c_str());
        }
    }
    
    }  // namespace angle