diff options
author | Andrew Meadows <andrew@lindenlab.com> | 2009-01-17 01:29:45 +0000 |
---|---|---|
committer | Andrew Meadows <andrew@lindenlab.com> | 2009-01-17 01:29:45 +0000 |
commit | 15a6d273cc00e1f4f9f9d56d8c878b46b283b289 (patch) | |
tree | f4ac9fa1f96c6d246b571412ce6a67ee1837794d /indra/lscript | |
parent | 446c55538e1fb12d8a1feb541edf99c16bb29121 (diff) |
svn merge -r108142:108148 svn+ssh://svn.lindenlab.com/svn/linden/qa/maint-server/maint-server-5-r108113
Diffstat (limited to 'indra/lscript')
-rw-r--r-- | indra/lscript/lscript_execute.h | 7 | ||||
-rw-r--r-- | indra/lscript/lscript_execute/lscript_execute.cpp | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h index b1b866570c..a22c37cfe9 100644 --- a/indra/lscript/lscript_execute.h +++ b/indra/lscript/lscript_execute.h @@ -452,9 +452,16 @@ public: // Called when the script is scheduled to be stopped from newsim/LLScriptData virtual void stopRunning() = 0; + // A timer is regularly checked to see if script takes too long, but we + // don't do it every opcode due to performance hits. + static void setTimerCheckSkip( S32 value ) { sTimerCheckSkip = value; } + static S32 getTimerCheckSkip() { return sTimerCheckSkip; } + private: BOOL mReset; + + static S32 sTimerCheckSkip; // Number of times to skip the timer check for performance reasons }; class LLScriptExecuteLSL2 : public LLScriptExecute diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 43834758f1..5630f2de0b 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -42,6 +42,10 @@ #include "lscript_heapruntime.h" #include "lscript_alloc.h" +// Static +const S32 DEFAULT_SCRIPT_TIMER_CHECK_SKIP = 4; +S32 LLScriptExecute::sTimerCheckSkip = DEFAULT_SCRIPT_TIMER_CHECK_SKIP; + void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); @@ -924,7 +928,7 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, // Run for a single timeslice, or until a yield or state transition is due F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) { - U32 timer_checks = 0; + S32 timer_checks = 0; F32 inloop = 0; // Loop while not finished, yield not due and time remaining @@ -936,12 +940,11 @@ F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **erro runInstructions(b_print, id, errorstr, events_processed, quanta); - static const S32 lsl_timer_check_skip = 4; if(isYieldDue()) { break; } - else if(timer_checks++ == lsl_timer_check_skip) + else if(timer_checks++ >= LLScriptExecute::sTimerCheckSkip) { inloop = timer.getElapsedTimeF32(); if(inloop > quanta) |