mirror of
https://github.com/nillerusr/source-engine.git
synced 2024-12-22 14:16:50 +00:00
engine: remove useless vprof for rcon
This commit is contained in:
parent
600695b15f
commit
1218fa659c
@ -56,12 +56,10 @@ public:
|
|||||||
// Immediately try to start vprofiling
|
// Immediately try to start vprofiling
|
||||||
// Also, enable cheats on this client only
|
// Also, enable cheats on this client only
|
||||||
Cmd_SetRptActive( true );
|
Cmd_SetRptActive( true );
|
||||||
StartVProfData();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void OnSocketClosed( SocketHandle_t hSocket, const netadr_t & netAdr, void* pData )
|
virtual void OnSocketClosed( SocketHandle_t hSocket, const netadr_t & netAdr, void* pData )
|
||||||
{
|
{
|
||||||
StopVProfData();
|
|
||||||
Cmd_SetRptActive( false );
|
Cmd_SetRptActive( false );
|
||||||
BaseClass::OnSocketClosed( hSocket, netAdr, pData );
|
BaseClass::OnSocketClosed( hSocket, netAdr, pData );
|
||||||
}
|
}
|
||||||
@ -98,135 +96,6 @@ static void RconAddressChanged_f( IConVar *pConVar, const char *pOldString, floa
|
|||||||
|
|
||||||
static ConVar rcon_address( "rcon_address", "", FCVAR_SERVER_CANNOT_QUERY|FCVAR_DONTRECORD, "Address of remote server if sending unconnected rcon commands (format x.x.x.x:p) ", RconAddressChanged_f );
|
static ConVar rcon_address( "rcon_address", "", FCVAR_SERVER_CANNOT_QUERY|FCVAR_DONTRECORD, "Address of remote server if sending unconnected rcon commands (format x.x.x.x:p) ", RconAddressChanged_f );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Implementation of remote vprof
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
CRConVProfExport::CRConVProfExport()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::AddListener()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::RemoveListener()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::SetBudgetFlagsFilter( int filter )
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
int CRConVProfExport::GetNumBudgetGroups()
|
|
||||||
{
|
|
||||||
return m_Info.Count();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::GetBudgetGroupInfos( CExportedBudgetGroupInfo *pInfos )
|
|
||||||
{
|
|
||||||
memcpy( pInfos, m_Info.Base(), GetNumBudgetGroups() * sizeof(CExportedBudgetGroupInfo) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::GetBudgetGroupTimes( float times[IVProfExport::MAX_BUDGETGROUP_TIMES] )
|
|
||||||
{
|
|
||||||
int nGroups = min( m_Times.Count(), (int)IVProfExport::MAX_BUDGETGROUP_TIMES );
|
|
||||||
memset( times, 0, nGroups * sizeof(float) );
|
|
||||||
nGroups = min( GetNumBudgetGroups(), nGroups );
|
|
||||||
memcpy( times, m_Times.Base(), nGroups * sizeof(float) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::PauseProfile()
|
|
||||||
{
|
|
||||||
// NOTE: This only has effect when testing on a listen server
|
|
||||||
// it shouldn't do anything in the wild. When drawing the budget panel
|
|
||||||
// this will cause the time spent doing so to not be counted
|
|
||||||
VProfExport_Pause();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::ResumeProfile()
|
|
||||||
{
|
|
||||||
// NOTE: This only has effect when testing on a listen server
|
|
||||||
// it shouldn't do anything in the wild
|
|
||||||
VProfExport_Resume();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::CleanupGroupData()
|
|
||||||
{
|
|
||||||
int nCount = m_Info.Count();
|
|
||||||
for ( int i = 0; i < nCount; ++i )
|
|
||||||
{
|
|
||||||
delete m_Info[i].m_pName;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_Info.RemoveAll();
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::OnRemoteGroupData( const void *data, int len )
|
|
||||||
{
|
|
||||||
CUtlBuffer buf( data, len, CUtlBuffer::READ_ONLY );
|
|
||||||
int nFirstGroup = buf.GetInt();
|
|
||||||
|
|
||||||
if ( nFirstGroup == 0 )
|
|
||||||
{
|
|
||||||
CleanupGroupData();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Assert( nFirstGroup == m_Info.Count() );
|
|
||||||
}
|
|
||||||
|
|
||||||
// NOTE: See WriteRemoteVProfGroupData in vprof_engine.cpp
|
|
||||||
// to see the encoding of this data
|
|
||||||
int nGroupCount = buf.GetInt();
|
|
||||||
int nBase = m_Info.AddMultipleToTail( nGroupCount );
|
|
||||||
char temp[1024];
|
|
||||||
for ( int i = 0; i < nGroupCount; ++i )
|
|
||||||
{
|
|
||||||
CExportedBudgetGroupInfo *pInfo = &m_Info[nBase + i];
|
|
||||||
|
|
||||||
unsigned char red, green, blue, alpha;
|
|
||||||
red = buf.GetUnsignedChar( );
|
|
||||||
green = buf.GetUnsignedChar( );
|
|
||||||
blue = buf.GetUnsignedChar( );
|
|
||||||
alpha = buf.GetUnsignedChar( );
|
|
||||||
buf.GetString( temp );
|
|
||||||
int nLen = Q_strlen( temp );
|
|
||||||
|
|
||||||
pInfo->m_Color.SetColor( red, green, blue, alpha );
|
|
||||||
char *pBuf = new char[ nLen + 1 ];
|
|
||||||
pInfo->m_pName = pBuf;
|
|
||||||
memcpy( pBuf, temp, nLen+1 );
|
|
||||||
pInfo->m_BudgetFlags = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CRConVProfExport::OnRemoteData( const void *data, int len )
|
|
||||||
{
|
|
||||||
// NOTE: See WriteRemoteVProfData in vprof_engine.cpp
|
|
||||||
// to see the encoding of this data
|
|
||||||
int nCount = len / sizeof(float);
|
|
||||||
Assert( nCount == m_Info.Count() );
|
|
||||||
|
|
||||||
CUtlBuffer buf( data, len, CUtlBuffer::READ_ONLY );
|
|
||||||
m_Times.SetCount( nCount );
|
|
||||||
memcpy( m_Times.Base(), data, nCount * sizeof(float) );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
CON_COMMAND( vprof_remote_start, "Request a VProf data stream from the remote server (requires authentication)" )
|
|
||||||
{
|
|
||||||
// TODO: Make this work (it might already!)
|
|
||||||
// RCONClient().StartVProfData();
|
|
||||||
}
|
|
||||||
|
|
||||||
CON_COMMAND( vprof_remote_stop, "Stop an existing remote VProf data request" )
|
|
||||||
{
|
|
||||||
// TODO: Make this work (it might already!)
|
|
||||||
// RCONClient().StopVProfData();
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef ENABLE_RPT
|
#ifdef ENABLE_RPT
|
||||||
CON_COMMAND_F( rpt_screenshot, "", FCVAR_HIDDEN | FCVAR_DONTRECORD )
|
CON_COMMAND_F( rpt_screenshot, "", FCVAR_HIDDEN | FCVAR_DONTRECORD )
|
||||||
{
|
{
|
||||||
@ -454,22 +323,6 @@ void CRConClient::ParseReceivedData()
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SERVERDATA_VPROF_DATA:
|
|
||||||
{
|
|
||||||
int nDataSize = m_RecvBuffer.GetInt();
|
|
||||||
m_VProfExport.OnRemoteData( m_RecvBuffer.PeekGet(), nDataSize );
|
|
||||||
m_RecvBuffer.SeekGet( CUtlBuffer::SEEK_CURRENT, nDataSize );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERVERDATA_VPROF_GROUPS:
|
|
||||||
{
|
|
||||||
int nDataSize = m_RecvBuffer.GetInt();
|
|
||||||
m_VProfExport.OnRemoteGroupData( m_RecvBuffer.PeekGet(), nDataSize );
|
|
||||||
m_RecvBuffer.SeekGet( CUtlBuffer::SEEK_CURRENT, nDataSize );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERVERDATA_RESPONSE_STRING:
|
case SERVERDATA_RESPONSE_STRING:
|
||||||
{
|
{
|
||||||
char pBuf[2048];
|
char pBuf[2048];
|
||||||
@ -706,45 +559,6 @@ void CRConClient::SendCmd( const char *msg )
|
|||||||
SendResponse( response );
|
SendResponse( response );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Start vprofiling
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CRConClient::StartVProfData()
|
|
||||||
{
|
|
||||||
if ( !IsConnected() )
|
|
||||||
{
|
|
||||||
if ( !ConnectSocket() )
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Override the vprof export to point to our local profiling data
|
|
||||||
OverrideVProfExport( &m_VProfExport );
|
|
||||||
|
|
||||||
CUtlBuffer response;
|
|
||||||
BuildResponse( response, SERVERDATA_VPROF, "", "" );
|
|
||||||
SendResponse( response );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: Stop vprofiling
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CRConClient::StopVProfData()
|
|
||||||
{
|
|
||||||
// Reset the vprof export to point to the normal profiling data
|
|
||||||
ResetVProfExport( &m_VProfExport );
|
|
||||||
|
|
||||||
// Don't bother restarting a connection to turn this off
|
|
||||||
if ( !IsConnected() )
|
|
||||||
return;
|
|
||||||
|
|
||||||
CUtlBuffer response;
|
|
||||||
BuildResponse( response, SERVERDATA_REMOVE_VPROF, "", "" );
|
|
||||||
SendResponse( response );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: get data from the server
|
// Purpose: get data from the server
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -27,47 +27,6 @@
|
|||||||
// memdbgon must be the last include file in a .cpp file!!!
|
// memdbgon must be the last include file in a .cpp file!!!
|
||||||
#include "tier0/memdbgon.h"
|
#include "tier0/memdbgon.h"
|
||||||
|
|
||||||
abstract_class IVProfData
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
virtual void OnRemoteGroupData( const void *data, int len ) = 0;
|
|
||||||
virtual void OnRemoteData( const void *data, int len ) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Used to display client perf data in showbudget
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
class CRConVProfExport : public IVProfExport, public IVProfData
|
|
||||||
{
|
|
||||||
// Inherited from IVProfExport
|
|
||||||
public:
|
|
||||||
virtual void AddListener();
|
|
||||||
virtual void RemoveListener();
|
|
||||||
virtual void PauseProfile();
|
|
||||||
virtual void ResumeProfile();
|
|
||||||
virtual void SetBudgetFlagsFilter( int filter );
|
|
||||||
virtual int GetNumBudgetGroups();
|
|
||||||
virtual void GetBudgetGroupInfos( CExportedBudgetGroupInfo *pInfos );
|
|
||||||
virtual void GetBudgetGroupTimes( float times[MAX_BUDGETGROUP_TIMES] );
|
|
||||||
|
|
||||||
// Inherited from IVProfData
|
|
||||||
public:
|
|
||||||
virtual void OnRemoteGroupData( const void *data, int len );
|
|
||||||
virtual void OnRemoteData( const void *data, int len );
|
|
||||||
|
|
||||||
// Other public methods
|
|
||||||
public:
|
|
||||||
CRConVProfExport();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void CleanupGroupData();
|
|
||||||
|
|
||||||
CUtlVector< CExportedBudgetGroupInfo > m_Info;
|
|
||||||
CUtlVector<float> m_Times; // Times from the most recent snapshot.
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class CRConClient : public ISocketCreatorListener
|
class CRConClient : public ISocketCreatorListener
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -89,10 +48,6 @@ public:
|
|||||||
bool IsConnected() const;
|
bool IsConnected() const;
|
||||||
bool IsAuthenticated() const { return m_bAuthenticated; }
|
bool IsAuthenticated() const { return m_bAuthenticated; }
|
||||||
|
|
||||||
void RegisterVProfDataCallback( IVProfData *callback );
|
|
||||||
void StopVProfData();
|
|
||||||
void StartVProfData();
|
|
||||||
|
|
||||||
void TakeScreenshot();
|
void TakeScreenshot();
|
||||||
void GrabConsoleLog();
|
void GrabConsoleLog();
|
||||||
|
|
||||||
@ -116,7 +71,6 @@ private:
|
|||||||
void SaveRemoteScreenshot( const void* pBuffer, int nBufLen );
|
void SaveRemoteScreenshot( const void* pBuffer, int nBufLen );
|
||||||
void SaveRemoteConsoleLog( const void* pBuffer, int nBufLen );
|
void SaveRemoteConsoleLog( const void* pBuffer, int nBufLen );
|
||||||
|
|
||||||
CRConVProfExport m_VProfExport;
|
|
||||||
CSocketCreator m_Socket;
|
CSocketCreator m_Socket;
|
||||||
netadr_t m_Address;
|
netadr_t m_Address;
|
||||||
int m_iAuthRequestID;
|
int m_iAuthRequestID;
|
||||||
|
@ -284,53 +284,6 @@ void CServerRemoteAccess::WriteDataRequest( CRConServer *pNetworkListener, ra_li
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#ifdef VPROF_ENABLED
|
|
||||||
case SERVERDATA_VPROF:
|
|
||||||
{
|
|
||||||
char password[25];
|
|
||||||
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
|
|
||||||
{
|
|
||||||
invalidRequest = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
|
|
||||||
{
|
|
||||||
invalidRequest = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( IsAuthenticated(listener) )
|
|
||||||
{
|
|
||||||
RegisterVProfDataListener( listener );
|
|
||||||
LogCommand( listener, "Remote VProf started!\n" );
|
|
||||||
RespondString( listener, requestID, "Remote VProf started!\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SERVERDATA_REMOVE_VPROF:
|
|
||||||
{
|
|
||||||
char password[25];
|
|
||||||
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
|
|
||||||
{
|
|
||||||
invalidRequest = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( !GetStringHelper( cmd, password, sizeof(password) ) )
|
|
||||||
{
|
|
||||||
invalidRequest = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ( IsAuthenticated(listener) )
|
|
||||||
{
|
|
||||||
RemoveVProfDataListener( listener );
|
|
||||||
LogCommand( listener, "Remote VProf finished!\n" );
|
|
||||||
RespondString( listener, requestID, "Remote VProf finished!\n" );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()"));
|
Assert(!("Unknown requestType in CServerRemoteAccess::WriteDataRequest()"));
|
||||||
cmd.Purge();
|
cmd.Purge();
|
||||||
@ -911,16 +864,6 @@ void CServerRemoteAccess::SendResponseToClient( ra_listener_id listenerID, Serve
|
|||||||
response.Put( pData, nDataLen );
|
response.Put( pData, nDataLen );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// Purpose: sends an opaque blob of data from VProf to a remote rcon listener
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
void CServerRemoteAccess::SendVProfData( ra_listener_id listenerID, bool bGroupData, void *data, int len )
|
|
||||||
{
|
|
||||||
Assert( listenerID != m_AdminUIID ); // only RCON clients support this right now
|
|
||||||
SendResponseToClient( listenerID, bGroupData ? SERVERDATA_VPROF_GROUPS : SERVERDATA_VPROF_DATA, data, len );
|
|
||||||
}
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: C function for rest of engine to access CServerRemoteAccess class
|
// Purpose: C function for rest of engine to access CServerRemoteAccess class
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
@ -15,9 +15,9 @@
|
|||||||
#include "tier0/vprof_telemetry.h"
|
#include "tier0/vprof_telemetry.h"
|
||||||
|
|
||||||
// VProf is enabled by default in all configurations -except- X360 Retail.
|
// VProf is enabled by default in all configurations -except- X360 Retail.
|
||||||
#if !( defined( _X360 ) && defined( _CERT ) )
|
//#if !( defined( _X360 ) && defined( _CERT ) )
|
||||||
#define VPROF_ENABLED
|
//#define VPROF_ENABLED
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
#if defined(_X360) && defined(VPROF_ENABLED)
|
#if defined(_X360) && defined(VPROF_ENABLED)
|
||||||
#include "tier0/pmc360.h"
|
#include "tier0/pmc360.h"
|
||||||
|
Loading…
Reference in New Issue
Block a user