From a1013e66bf79a6475f6754fed4904c468a1533a5 Mon Sep 17 00:00:00 2001 From: Andrzej Kapolka Date: Tue, 22 Mar 2011 22:36:34 +0000 Subject: [PATCH] Provide a means of setting the unit profile sampling frequency. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6543 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- .../presents/server/PresentsDObjectMgr.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java index 5a6066cc3..dd6b86088 100644 --- a/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java +++ b/src/main/java/com/threerings/presents/server/PresentsDObjectMgr.java @@ -418,6 +418,22 @@ public class PresentsDObjectMgr }); } + /** + * Sets the frequency at which we take profiling samples. + */ + public void setUnitProfInterval (int interval) + { + _unitProfInterval = interval; + } + + /** + * Returns the profiling sample frequency. + */ + public int getUnitProfInterval () + { + return _unitProfInterval; + } + /** * Dumps collected profiling information to the system log. */ @@ -681,7 +697,7 @@ public class PresentsDObjectMgr } // periodically sample and record the time spent processing a unit - if (UNIT_PROF_ENABLED && _eventCount % UNIT_PROF_INTERVAL == 0) { + if (UNIT_PROF_ENABLED && _eventCount % _unitProfInterval == 0) { String cname; // do some jiggery pokery to get more fine grained profiling details on certain // "popular" unit types @@ -1098,12 +1114,12 @@ public class PresentsDObjectMgr /** Used to resolve unit names when profiling. Injected by the invmgr when it's created. */ protected InvocationManager _invmgr; + /** The frequency at which we take a profiling sample. */ + protected int _unitProfInterval = 100; + /** Whether or not unit profiling is enabled. */ protected static final boolean UNIT_PROF_ENABLED = true; - /** The frequency with which we take a profiling sample. */ - protected static final int UNIT_PROF_INTERVAL = 100; - /** The default size of an oid list refs vector. */ protected static final int DEFREFVEC_SIZE = 4;