Ticket #1862: ConventionFixV1.patch

File ConventionFixV1.patch, 4.7 KB (added by Stan, 10 years ago)
  • binaries/data/config/default.cfg

     
    328328; > PROFILER
    329329hotkey.profile.toggle = "F11"               ; Enable/disable real-time profiler
    330330hotkey.profile.save = "Shift+F11"           ; Save current profiler data to logs/profile.txt
    331 hotkey.profile2.enable = "F11"              ; Enable HTTP/GPU modes for new profiler
     331hotkey.profile2.toggle = "Ctrl+F11"         ; Enable/disable HTTP/GPU modes for new profiler
    332332
    333 profiler2.http.autoenable = false           ; Enable HTTP server output at startup (default off for security/performance)
     333profiler2.autoenable = false                ; Enable HTTP server output at startup (default off for security/performance)
    334334profiler2.script.enable = false             ; Enable Javascript profiling. Needs to be set before startup and can't be changed later. (default off for performance)
    335 profiler2.gpu.autoenable = false            ; Enable GPU timing at startup (default off for performance/compatibility)
    336335profiler2.gpu.arb.enable = true             ; Allow GL_ARB_timer_query timing mode when available
    337336profiler2.gpu.ext.enable = true             ; Allow GL_EXT_timer_query timing mode when available
    338337profiler2.gpu.intel.enable = true           ; Allow GL_INTEL_performance_queries timing mode when available
  • source/main.cpp

     
    161161#endif
    162162            return IN_HANDLED;
    163163        }
    164         else if (hotkey == "profile2.enable")
     164        else if (hotkey == "profile2.toggle")
    165165        {
    166             g_Profiler2.EnableGPU();
    167             g_Profiler2.EnableHTTP();
     166            g_Profiler2.Toggle();
    168167            return IN_HANDLED;
    169168        }
    170169        break;
  • source/ps/GameSetup/GameSetup.cpp

     
    955955    // Optionally start profiler HTTP output automatically
    956956    // (By default it's only enabled by a hotkey, for security/performance)
    957957    bool profilerHTTPEnable = false;
    958     CFG_GET_VAL("profiler2.http.autoenable", Bool, profilerHTTPEnable);
     958    CFG_GET_VAL("profiler2.autoenable", Bool, profilerHTTPEnable);
    959959    if (profilerHTTPEnable)
    960960        g_Profiler2.EnableHTTP();
    961961
     
    992992    // Optionally start profiler GPU timings automatically
    993993    // (By default it's only enabled by a hotkey, for performance/compatibility)
    994994    bool profilerGPUEnable = false;
    995     CFG_GET_VAL("profiler2.gpu.autoenable", Bool, profilerGPUEnable);
     995    CFG_GET_VAL("profiler2.autoenable", Bool, profilerGPUEnable);
    996996    if (profilerGPUEnable)
    997997        g_Profiler2.EnableGPU();
    998998
  • source/ps/Profiler2.cpp

     
    1 /* Copyright (c) 2011 Wildfire Games
     1/* Copyright (c) 2014 Wildfire Games
    22 *
    33 * Permission is hereby granted, free of charge, to any person obtaining
    44 * a copy of this software and associated documentation files (the
     
    157157void CProfiler2::EnableHTTP()
    158158{
    159159    ENSURE(m_Initialised);
     160    LOGMESSAGERENDER(L"Starting profiler2 HTTP server");
    160161
    161162    // Ignore multiple enablings
    162163    if (m_MgContext)
     
    175176{
    176177    ENSURE(m_Initialised);
    177178    if (!m_GPU)
     179    {
     180        LOGMESSAGERENDER(L"Starting profiler2 GPU mode");
    178181        InitialiseGPU();
     182    }
    179183}
    180184
    181185void CProfiler2::ShutdownGPU()
    182186{
     187    LOGMESSAGERENDER(L"Shutting down profiler2 GPU mode");
    183188    SAFE_DELETE(m_GPU);
    184189}
    185190
     191void CProfiler2::ShutDownHTTP()
     192{
     193    LOGMESSAGERENDER(L"Shutting down profiler2 HTTP server");
     194    if (m_MgContext)
     195    {
     196        mg_stop(m_MgContext);
     197        m_MgContext = NULL;
     198    }
     199}
     200
     201void CProfiler2::Toggle()
     202{
     203    //TODO: Maybe we can open the browser to the profiler page automatically
     204    if (m_GPU && m_MgContext)
     205    {
     206        ShutdownGPU();
     207        ShutDownHTTP();
     208    }
     209    else if (!m_GPU && !m_MgContext)
     210    {
     211        EnableGPU();
     212        EnableHTTP();
     213    }
     214}
     215
    186216void CProfiler2::Shutdown()
    187217{
    188218    ENSURE(m_Initialised);
  • source/ps/Profiler2.h

     
    276276    void ShutdownGPU();
    277277
    278278    /**
     279     * Call in main thread to shut down the profiler's HTTP server
     280     */
     281    void ShutDownHTTP();
     282
     283    /**
     284     * Call in main thread to enable/disable the profiler
     285     */
     286    void Toggle();
     287
     288    /**
    279289     * Call in main thread to shut everything down.
    280290     * All other profiled threads should have been terminated already.
    281291     */