Skip to content

Commit

Permalink
- Updated code for rtclock.{c,h}. The new stopwatch uses a clock inde…
Browse files Browse the repository at this point in the history
…x outside the range of the user-accessible clocks instead of 13.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6106 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Sep 13, 2010
1 parent 1e6d000 commit 9f11b67
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
2 changes: 0 additions & 2 deletions Compiler/runtime/rtclock.c
Expand Up @@ -28,8 +28,6 @@
*
*/

#define NUM_RT_CLOCKS 16

#if defined(__MINGW32__) || defined(_MSC_VER)

#include <windows.h>
Expand Down
4 changes: 4 additions & 0 deletions Compiler/runtime/rtclock.h
Expand Up @@ -31,6 +31,10 @@
#ifndef __RTCLOCK__H
#define __RTCLOCK__H

#define NUM_RT_CLOCKS 17
#define NUM_USER_RT_CLOCKS 16
#define RT_CLOCK_SPECIAL_STOPWATCH 16 /* The 17th clock */

void rt_tick(int ix);
double rt_tock(int ix);

Expand Down
8 changes: 4 additions & 4 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -2983,7 +2983,7 @@ RML_END_LABEL
RML_BEGIN_LABEL(System__realtimeTick)
{
int ix = RML_UNTAGFIXNUM(rmlA0);
if (ix < 0 || ix > 15) RML_TAILCALLK(rmlFC);
if (ix < 0 || ix >= NUM_USER_RT_CLOCKS) RML_TAILCALLK(rmlFC);
rt_tick(ix);
RML_TAILCALLK(rmlSC);
}
Expand All @@ -2992,7 +2992,7 @@ RML_END_LABEL
RML_BEGIN_LABEL(System__realtimeTock)
{
int ix = RML_UNTAGFIXNUM(rmlA0);
if (ix < 0 || ix > 15) RML_TAILCALLK(rmlFC);
if (ix < 0 || ix >= NUM_USER_RT_CLOCKS) RML_TAILCALLK(rmlFC);
rmlA0 = mk_rcon(rt_tock(ix));
RML_TAILCALLK(rmlSC);
}
Expand All @@ -3011,15 +3011,15 @@ RML_END_LABEL
RML_BEGIN_LABEL(System__startTimer)
{
/* start the timer */
rt_tick(13);
rt_tick(RT_CLOCK_SPECIAL_STOPWATCH);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL

RML_BEGIN_LABEL(System__stopTimer)
{
/* cummulate the timer time */
timerTime += rt_tock(13);
timerTime += rt_tock(RT_CLOCK_SPECIAL_STOPWATCH);
RML_TAILCALLK(rmlSC);
}
RML_END_LABEL
Expand Down

0 comments on commit 9f11b67

Please sign in to comment.