src/core/model/unix-system-wall-clock-ms.cc
author Tom Henderson <tomh@tomh.org>
Sat, 16 Jan 2016 08:14:40 -0800
changeset 11683 9142266fbb25
parent 11097 caafe12b0378
permissions -rw-r--r--
add figures to main documentation build
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2005 INRIA
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage.inria.fr>
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
    21
#include "system-wall-clock-ms.h"
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    22
#include "abort.h"
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
    23
#include "log.h"
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    24
#include <sys/times.h>
7756
a3a5f9215aae Explicitly including the unistd.h header file is needed on some systems where POSIX system calls are used
Tom Goff <tgoff@tgoff.net>
parents: 7386
diff changeset
    25
#include <unistd.h>
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    26
11097
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    27
/**
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    28
 * \file
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    29
 * \ingroup system
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    30
 * Wall clock class ns3::SystemWallClockMs implementation
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    31
 * for Unix-like systems.
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    32
 */
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    33
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9134
diff changeset
    34
namespace ns3 {
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
    35
10968
2d29fee2b7b8 [Bug 1551] Redux: NS_LOG_COMPONENT_DEFINE inside or outside of ns3 namespace?
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 9134
diff changeset
    36
NS_LOG_COMPONENT_DEFINE ("SystemWallClockMsPrivate");
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    38
/**
11097
caafe12b0378 [Doxygen] OS functions: filesystem, threading, wall clock.
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 11046
diff changeset
    39
 * \ingroup system
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    40
 * \brief System-dependent implementation for SystemWallClockMs
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    41
 */
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
    42
class SystemWallClockMsPrivate {
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
public:
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    44
  /** \copydoc SystemWallClockMs::Start() */
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    45
  void Start (void);
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    46
  /** \copydoc SystemWallClockMs::End() */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    47
  int64_t End (void);
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    48
  /** \copydoc SystemWallClockMs::GetElapsedReal() */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    49
  int64_t GetElapsedReal (void) const;
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    50
  /** \copydoc SystemWallClockMs::GetElapsedUser() */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    51
  int64_t GetElapsedUser (void) const;
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    52
  /** \copydoc SystemWallClockMs::GetElapsedSystem() */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    53
  int64_t GetElapsedSystem (void) const;
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    54
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
private:
11046
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    56
  struct tms m_startTimes;  //!< The native time structure.
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    57
  clock_t m_startTime;      //!< Native real time.
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    58
  int64_t m_elapsedReal;    //!< Elapsed real time, in ms.
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    59
  int64_t m_elapsedUser;    //!< Elapsed user time, in ms.
e62bccfbe56e [Doxygen] various in src/core
Peter D. Barnes, Jr. <barnes26@llnl.gov>
parents: 10968
diff changeset
    60
  int64_t m_elapsedSystem;  //!< Elapsed system time, in ms.
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
};
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
void 
122
6b8f1eda5c57 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 110
diff changeset
    64
SystemWallClockMsPrivate::Start (void)
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
    66
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    67
  m_startTime = times (&m_startTimes);
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
}
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    70
int64_t
122
6b8f1eda5c57 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 110
diff changeset
    71
SystemWallClockMsPrivate::End (void)
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
{
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    73
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    74
  // We need to return the number of milliseconds that have elapsed in some
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    75
  // reasonably portable way.  The underlying function that we will use returns
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    76
  // a number of elapsed ticks.  We can look up the number of ticks per second
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    77
  // from the system configuration.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    78
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    79
  // Conceptually, we need to find the number of elapsed clock ticks and then
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    80
  // multiply the result by the milliseconds per clock tick (or divide by clock
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    81
  // ticks per millisecond).  Integer dividing by clock ticks per millisecond
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    82
  // is bad since this number is fractional on most machines and would result
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    83
  // in divide by zero errors due to integer rounding.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    84
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    85
  // Multiplying by milliseconds per clock tick works up to a clock resolution 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    86
  // of 1000 ticks per second.  If we go  past this point, we begin to get zero
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    87
  // elapsed times when millisecondsPerTick becomes fractional and another 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    88
  // rounding error appears.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    89
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    90
  // So rounding errors using integers can bite you from both direction.  Since 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    91
  // all of our targets have math coprocessors, why not just use doubles 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    92
  // internally?  Works fine, lasts a long time.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    93
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    94
  // If millisecondsPerTick becomes fractional, and an elapsed time greater than 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    95
  // a milliscond is measured, the function will work as expected.  If an elapsed 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    96
  // time is measured that turns out to be less than a millisecond, we'll just 
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    97
  // return zero which would, I think, also will be expected.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    98
  //
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
    99
  NS_LOG_FUNCTION (this);
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   100
  static int64_t ticksPerSecond = sysconf (_SC_CLK_TCK);
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   101
  static double millisecondsPerTick = 1000. / ticksPerSecond;
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   102
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   103
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   104
  // If sysconf () fails, we have no idea how to do the required conversion to ms.
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   105
  //
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   106
  NS_ABORT_MSG_IF (ticksPerSecond == -1, "SystemWallClockMsPrivate(): Cannot sysconf (_SC_CLK_TCK)");
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   107
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   108
  struct tms endTimes;
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   109
  clock_t endTime = times (&endTimes);
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   110
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   111
  double tmp;
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   112
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   113
  tmp = static_cast<double> (endTime - m_startTime) * millisecondsPerTick;
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   114
  m_elapsedReal = static_cast<int64_t> (tmp);
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   115
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   116
  tmp = static_cast<double> (endTimes.tms_utime - m_startTimes.tms_utime) * millisecondsPerTick;
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   117
  m_elapsedUser = static_cast<int64_t> (tmp);
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   118
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   119
  tmp = static_cast<double> (endTimes.tms_stime - m_startTimes.tms_stime) * millisecondsPerTick;
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   120
  m_elapsedSystem = static_cast<int64_t> (tmp);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   121
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   122
  return m_elapsedReal;
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
}
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   125
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   126
SystemWallClockMsPrivate::GetElapsedReal (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   127
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   128
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   129
  return m_elapsedReal;
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   130
}
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   131
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   132
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   133
SystemWallClockMsPrivate::GetElapsedUser (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   134
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   135
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   136
  return m_elapsedUser;
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   137
}
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   138
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   139
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   140
SystemWallClockMsPrivate::GetElapsedSystem (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   141
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   142
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   143
  return m_elapsedSystem;
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   144
}
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   145
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
   146
SystemWallClockMs::SystemWallClockMs ()
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
   147
  : m_priv (new SystemWallClockMsPrivate ())
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   148
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   149
  NS_LOG_FUNCTION (this);
7169
358f71a624d8 core coding style changes
Josh Pelkey <jpelkey@gatech.edu>
parents: 6821
diff changeset
   150
}
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
   152
SystemWallClockMs::~SystemWallClockMs ()
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   154
  NS_LOG_FUNCTION (this);
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
   155
  delete m_priv;
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
   156
  m_priv = 0;
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
}
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
void
122
6b8f1eda5c57 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 110
diff changeset
   160
SystemWallClockMs::Start (void)
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   162
  NS_LOG_FUNCTION (this);
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
   163
  m_priv->Start ();
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
}
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   165
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   166
int64_t
122
6b8f1eda5c57 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 110
diff changeset
   167
SystemWallClockMs::End (void)
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   169
  NS_LOG_FUNCTION (this);
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
   170
  return m_priv->End ();
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
}
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   172
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   173
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   174
SystemWallClockMs::GetElapsedReal (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   175
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   176
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   177
  return m_priv->GetElapsedReal ();
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   178
}
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   179
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   180
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   181
SystemWallClockMs::GetElapsedUser (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   182
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   183
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   184
  return m_priv->GetElapsedUser ();
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   185
}
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   186
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
   187
int64_t
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   188
SystemWallClockMs::GetElapsedSystem (void) const
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   189
{
9134
7a750f032acd Clean up function logging of core module.
Maja Grubišić <maja.grubisic@live.com>
parents: 7756
diff changeset
   190
  NS_LOG_FUNCTION (this);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   191
  return m_priv->GetElapsedSystem ();
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   192
}
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
   193
7386
2310ed220a61 standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents: 7169
diff changeset
   194
} // namespace ns3