sm_dump_handles now shows memory usage
--HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401772
This commit is contained in:
+18
-1
@@ -52,7 +52,7 @@
|
||||
#include <sp_vm_types.h>
|
||||
|
||||
#define SMINTERFACE_HANDLESYSTEM_NAME "IHandleSys"
|
||||
#define SMINTERFACE_HANDLESYSTEM_VERSION 2
|
||||
#define SMINTERFACE_HANDLESYSTEM_VERSION 3
|
||||
|
||||
/** Specifies no Identity */
|
||||
#define DEFAULT_IDENTITY NULL
|
||||
@@ -195,8 +195,25 @@ namespace SourceMod
|
||||
public:
|
||||
/**
|
||||
* @brief Called when destroying a handle. Must be implemented.
|
||||
*
|
||||
* @param type Handle type.
|
||||
* @param object Handle internal object.
|
||||
*/
|
||||
virtual void OnHandleDestroy(HandleType_t type, void *object) =0;
|
||||
|
||||
/**
|
||||
* @brief Called to get the size of a handle's memory usage in bytes.
|
||||
* Implementation is optional.
|
||||
*
|
||||
* @param type Handle type.
|
||||
* @param object Handle internal object.
|
||||
* @param pSize Pointer to store the approximate memory usage in bytes.
|
||||
* @return True on success, false if not implemented.
|
||||
*/
|
||||
virtual bool GetHandleApproxSize(HandleType_t type, void *object, unsigned int *pSize)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
+22
-1
@@ -36,7 +36,7 @@
|
||||
#include <IHandleSys.h>
|
||||
|
||||
#define SMINTERFACE_MENUMANAGER_NAME "IMenuManager"
|
||||
#define SMINTERFACE_MENUMANAGER_VERSION 13
|
||||
#define SMINTERFACE_MENUMANAGER_VERSION 14
|
||||
|
||||
/**
|
||||
* @file IMenuManager.h
|
||||
@@ -323,6 +323,13 @@ namespace SourceMod
|
||||
* -1, then the panel has no text limit.
|
||||
*/
|
||||
virtual int GetAmountRemaining() =0;
|
||||
|
||||
/**
|
||||
* @brief For the Handle system, returns approximate memory usage.
|
||||
*
|
||||
* @return Approximate number of bytes being used.
|
||||
*/
|
||||
virtual unsigned int GetApproxMemUsage() =0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -406,6 +413,13 @@ namespace SourceMod
|
||||
* @return Handle_t pointing to this object.
|
||||
*/
|
||||
virtual Handle_t GetHandle() =0;
|
||||
|
||||
/**
|
||||
* @brief For the Handle system, returns approximate memory usage.
|
||||
*
|
||||
* @return Approximate number of bytes being used.
|
||||
*/
|
||||
virtual unsigned int GetApproxMemUsage() =0;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -597,6 +611,13 @@ namespace SourceMod
|
||||
unsigned int time,
|
||||
unsigned int start_item,
|
||||
IMenuHandler *alt_handler=NULL) =0;
|
||||
|
||||
/**
|
||||
* @brief For the Handle system, returns approximate memory usage.
|
||||
*
|
||||
* @return Approximate number of bytes being used.
|
||||
*/
|
||||
virtual unsigned int GetApproxMemUsage() =0;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -877,6 +877,13 @@ private:
|
||||
|
||||
return x_check_multi(offsets, count, to_check+1);
|
||||
}
|
||||
public:
|
||||
size_t mem_usage()
|
||||
{
|
||||
return (sizeof(KTrieNode) * (m_baseSize))
|
||||
+ m_stSize
|
||||
+ sizeof(KTrieNode);
|
||||
}
|
||||
private:
|
||||
KTrieNode *m_base; /* Base array for the sparse tables */
|
||||
KTrieNode *m_empty; /* Special case for empty strings */
|
||||
|
||||
Reference in New Issue
Block a user