Add Profiler methodmap (#814)

* Add profiler methodmap

* No tag mismatches here

thanks pm

* Lets fix some documentation while we're here.

* Use proper methodmap documentation style

Across sm we use `//` for methodmap docs, so lets just keep this consistent
This commit is contained in:
Michael Flaherty 2018-07-08 08:05:29 -07:00 committed by Nicholas Hastings
parent 85a1d3e78a
commit c09b32010f
2 changed files with 35 additions and 4 deletions

View File

@ -223,6 +223,11 @@ REGISTER_NATIVES(profilerNatives)
{"EnterProfilingEvent", EnterProfilingEvent},
{"LeaveProfilingEvent", LeaveProfilingEvent},
{"IsProfilingActive", IsProfilingActive},
{"Profiler.Profiler", CreateProfiler},
{"Profiler.Time.get", GetProfilerTime},
{"Profiler.Start", StartProfiling},
{"Profiler.Stop", StopProfiling},
{NULL, NULL},
};

View File

@ -1,7 +1,7 @@
/**
* vim: set ts=4 :
* =============================================================================
* SourceMod (C)2004-2008 AlliedModders LLC. All rights reserved.
* SourceMod (C)2004-2018 AlliedModders LLC. All rights reserved.
* =============================================================================
*
* This file is part of the SourceMod/SourcePawn SDK.
@ -38,14 +38,40 @@
/**
* ONLY AVAILABLE ON WINDOWS RIGHT NOW K.
*/
methodmap Profiler < Handle
{
// Creates a new profile object. The Handle must be freed
// using delete or CloseHandle().
//
// @return A new Profiler Handle.
public native Profiler();
// Starts a cycle for profiling.
public native void Start();
// Stops a cycle for profiling.
//
// @error Profiler was never started.
public native void Stop();
// Returns the amount of high-precision time in seconds
// that passed during the profiler's last start/stop
// cycle.
//
// @return Time elapsed in seconds.
property float Time {
public native get();
}
}
/**
* Creates a new profile object. The Handle must be freed
* using CloseHandle().
* using delete or CloseHandle().
*
* @return Handle to the profiler object.
*/
native Handle CreateProfiler();
native Profiler CreateProfiler();
/**
* Starts profiling.