Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Adding Compiler/runtime/rtclock.c; a part of the System module
- Contains functions for _accurate_ timing (the Linux timer reports a 1-nanosecond resolution) - Added extra fields to the SimulationResult record returned by simulate() - totalTime, timeFrontend, timeBackend, timeCodegen, timeCompile, timeSimulation - The fields are disabled when running omc through rtest - Added new flag to omc, --running-testsuite flag (note that you need to use -- --running-testsuite in order to prevent the RML runtime from eating the flag) git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@6075 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
- Loading branch information
Showing
10 changed files
with
260 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* This file is part of OpenModelica. | ||
* | ||
* Copyright (c) 1998-2010, Linköpings University, | ||
* Department of Computer and Information Science, | ||
* SE-58183 Linköping, Sweden. | ||
* | ||
* All rights reserved. | ||
* | ||
* THIS PROGRAM IS PROVIDED UNDER THE TERMS OF THIS OSMC PUBLIC | ||
* LICENSE (OSMC-PL). ANY USE, REPRODUCTION OR DISTRIBUTION OF | ||
* THIS PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THE OSMC | ||
* PUBLIC LICENSE. | ||
* | ||
* The OpenModelica software and the Open Source Modelica | ||
* Consortium (OSMC) Public License (OSMC-PL) are obtained | ||
* from Linköpings University, either from the above address, | ||
* from the URL: http://www.ida.liu.se/projects/OpenModelica | ||
* and in the OpenModelica distribution. | ||
* | ||
* This program is distributed WITHOUT ANY WARRANTY; without | ||
* even the implied warranty of MERCHANTABILITY or FITNESS | ||
* FOR A PARTICULAR PURPOSE, EXCEPT AS EXPRESSLY SET FORTH | ||
* IN THE BY RECIPIENT SELECTED SUBSIDIARY LICENSE CONDITIONS | ||
* OF OSMC-PL. | ||
* | ||
* See the full OSMC Public License conditions for more details. | ||
* | ||
*/ | ||
|
||
#define NUM_RT_CLOCKS 16 | ||
|
||
#if defined(__MINGW32__) || defined(_MSC_VER) | ||
|
||
LARGE_INTEGER performance_frequency; | ||
LARGE_INTEGER tick_tp[NUM_RT_CLOCKS]; | ||
|
||
void rt_tick(int ix) { | ||
static int init = 0; | ||
if (!init) { | ||
init = 1; | ||
QueryPerformanceFrequency(&performance_frequency); | ||
} | ||
QueryPerformanceCounter(&tick_tp[ix]); | ||
} | ||
|
||
double rt_tock(int ix) { | ||
LARGE_INTEGER tock_tp; | ||
QueryPerformanceCounter(&tock_tp); | ||
return ((double)(tock_tp.QuadPart - tick_tp[ix].QuadPart)) / (performance_frequency); | ||
} | ||
|
||
#elif defined(__APPLE_CC__) | ||
|
||
#include <mach/mach_time.h> | ||
#include <time.h> | ||
|
||
uint64_t tick_tp[NUM_RT_CLOCKS]; | ||
|
||
void rt_tick(int ix) { | ||
tick_tp[ix] = mach_absolute_time(); | ||
} | ||
|
||
double rt_tock(int ix) { | ||
uint64_t tock_tp = mach_absolute_time(); | ||
uint64_t nsec; | ||
static mach_timebase_info_data_t info = {0,0}; | ||
if (info.denom == 0) | ||
mach_timebase_info(&info); | ||
uint64_t elapsednano = (tock_tp-tick_tp[ix]) * (info.numer / info.denom); | ||
return elapsednano * 1e-9; | ||
} | ||
|
||
#else | ||
|
||
#include <time.h> | ||
|
||
struct timespec tick_tp[NUM_RT_CLOCKS]; | ||
|
||
void rt_tick(int ix) { | ||
clock_gettime(CLOCK_MONOTONIC, &tick_tp[ix]); | ||
} | ||
|
||
double rt_tock(int ix) { | ||
struct timespec tock_tp = {0,0}; | ||
clock_gettime(CLOCK_MONOTONIC, &tock_tp); | ||
return (tock_tp.tv_sec - tick_tp[ix].tv_sec) + (tock_tp.tv_nsec - tick_tp[ix].tv_nsec)*1e-9; | ||
} | ||
|
||
#endif |
Oops, something went wrong.