From fac52a2897959e0442050298ad0539d50eea3182 Mon Sep 17 00:00:00 2001
From: David Anderson <dvander@alliedmods.net>
Date: Tue, 24 Jun 2014 01:18:16 -0700
Subject: [PATCH] Fill out API more.

---
 core/logic/ProfileTools.cpp   |  2 +-
 core/vprof_tool.cpp           |  9 ++++++++-
 core/vprof_tool.h             |  3 ++-
 public/sourcepawn/sp_vm_api.h | 13 +++++++++++--
 4 files changed, 22 insertions(+), 5 deletions(-)

diff --git a/core/logic/ProfileTools.cpp b/core/logic/ProfileTools.cpp
index 5cf9e5af..e528d8d5 100644
--- a/core/logic/ProfileTools.cpp
+++ b/core/logic/ProfileTools.cpp
@@ -95,7 +95,7 @@ ProfileToolManager::OnRootConsoleCommand2(const char *cmdname, const ICommandArg
 			}
 			g_pSourcePawn2->DisableProfiling();
 			g_pSourcePawn2->SetProfilingTool(nullptr);
-			active_->Stop();
+			active_->Stop(render_help);
 			active_->RenderHelp(render_help);
 			return;
 		}
diff --git a/core/vprof_tool.cpp b/core/vprof_tool.cpp
index 95519422..2d935309 100644
--- a/core/vprof_tool.cpp
+++ b/core/vprof_tool.cpp
@@ -66,9 +66,10 @@ VProfTool::Start()
 }
 
 void
-VProfTool::Stop()
+VProfTool::Stop(void (*render)(const char *fmt, ...))
 {
 	g_VProfCurrentProfile.Stop();
+	RenderHelp(render);
 }
 
 bool
@@ -77,6 +78,12 @@ VProfTool::IsActive()
 	return g_VProfCurrentProfile.IsEnabled();
 }
 
+bool
+VProfTool::IsAttached()
+{
+	return true;
+}
+
 intptr_t
 VProfTool::RegisterCode(
 	uintptr_t addr,
diff --git a/core/vprof_tool.h b/core/vprof_tool.h
index 14bb0379..e1d0c997 100644
--- a/core/vprof_tool.h
+++ b/core/vprof_tool.h
@@ -43,8 +43,9 @@ public:
 	const char *Name() KE_OVERRIDE;
 	const char *Description() KE_OVERRIDE;
 	bool Start() KE_OVERRIDE;
-	void Stop() KE_OVERRIDE;
+	void Stop(void (*render)(const char *fmt, ...)) KE_OVERRIDE;
 	bool IsActive() KE_OVERRIDE;
+	bool IsAttached() KE_OVERRIDE;
 	intptr_t RegisterCode(
 		uintptr_t addr,
 		size_t length,
diff --git a/public/sourcepawn/sp_vm_api.h b/public/sourcepawn/sp_vm_api.h
index d3253fa9..fdb7338f 100644
--- a/public/sourcepawn/sp_vm_api.h
+++ b/public/sourcepawn/sp_vm_api.h
@@ -1040,16 +1040,25 @@ namespace SourcePawn
 
 		/**
 		 * @brief Initiate a stop command.
+		 *
+		 * @param render            Function to render any help messages.
 		 */
-		virtual void Stop() = 0;
+		virtual void Stop(void (*render)(const char *fmt, ...)) = 0;
 	
 		/**
-		 * @brief Returns whether or not a profiler is active.
+		 * @brief Returns whether or not the profiler is currently profiling.
 		 *
 		 * @return                  True if active, false otherwise.
 		 */
 		virtual bool IsActive() = 0;
 
+		/**
+		 * @brief Returns whether the profiler is attached.
+		 *
+		 * @return                  True if attached, false otherwise.
+		 */
+		virtual bool IsAttached() = 0;
+
 		/**
 		 * @brief Registers JIT code with the profiler.
 		 *