A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
[mc] Bug: MC was reading from the wrong region
[simgrid.git]
/
src
/
xbt
/
xbt_os_time.c
diff --git
a/src/xbt/xbt_os_time.c
b/src/xbt/xbt_os_time.c
index
4e0f331
..
2f45c1c
100644
(file)
--- a/
src/xbt/xbt_os_time.c
+++ b/
src/xbt/xbt_os_time.c
@@
-1,6
+1,6
@@
/* xbt_os_time.c -- portable interface to time-related functions */
/* xbt_os_time.c -- portable interface to time-related functions */
-/* Copyright (c) 2007
, 2008, 2009, 2010
. The SimGrid Team.
+/* Copyright (c) 2007
-2010, 2012-2014
. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
@@
-19,7
+19,7
@@
//Freebsd doesn't provide this clock_gettime flag yet, because it was added too recently (after 1993)
#ifdef __FreeBSD__
//Freebsd doesn't provide this clock_gettime flag yet, because it was added too recently (after 1993)
#ifdef __FreeBSD__
-#define CLOCK_PROCESS_CPUT
T
IME_ID CLOCK_PROF
+#define CLOCK_PROCESS_CPUTIME_ID CLOCK_PROF
#endif
double xbt_os_time(void)
#endif
double xbt_os_time(void)
@@
-92,13
+92,17
@@
void xbt_os_sleep(double sec)
struct s_xbt_os_timer {
#ifdef HAVE_POSIX_GETTIME
struct timespec start, stop, elapse;
struct s_xbt_os_timer {
#ifdef HAVE_POSIX_GETTIME
struct timespec start, stop, elapse;
-#elif defined(HAVE_GETTIMEOFDAY)
+#elif defined(HAVE_GETTIMEOFDAY)
|| defined(_XBT_WIN32)
struct timeval start, stop, elapse;
#else
unsigned long int start, stop, elapse;
#endif
};
struct timeval start, stop, elapse;
#else
unsigned long int start, stop, elapse;
#endif
};
+size_t xbt_os_timer_size(void){
+ return sizeof(struct s_xbt_os_timer);
+}
+
xbt_os_timer_t xbt_os_timer_new(void)
{
return xbt_new0(struct s_xbt_os_timer, 1);
xbt_os_timer_t xbt_os_timer_new(void)
{
return xbt_new0(struct s_xbt_os_timer, 1);
@@
-249,7
+253,7
@@
void xbt_os_cputimer_start(xbt_os_timer_t timer)
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec = 0;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec = 0;
- timer->elapse.tv_
n
sec = 0;
+ timer->elapse.tv_
u
sec = 0;
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else
@@
-277,7
+281,7
@@
void xbt_os_cputimer_resume(xbt_os_timer_t timer)
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
- timer->elapse.tv_
nsec += timer->stop.tv_nsec - timer->start.tv_n
sec;
+ timer->elapse.tv_
usec += timer->stop.tv_usec - timer->start.tv_u
sec;
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else
@@
-357,7
+361,7
@@
void xbt_os_threadtimer_resume(xbt_os_timer_t timer)
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
clock_gettime(CLOCK_THREAD_CPUTIME_ID, &(timer->start));
#elif defined(_XBT_WIN32)
timer->elapse.tv_sec += timer->stop.tv_sec - timer->start.tv_sec;
- timer->elapse.tv_
nsec += timer->stop.tv_nsec - timer->start.tv_n
sec;
+ timer->elapse.tv_
usec += timer->stop.tv_usec - timer->start.tv_u
sec;
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else
# if defined(WIN32_WCE) || (_WIN32_WINNT < 0x0400)
THROW_UNIMPLEMENTED;
# else