src/core/model/system-wall-clock-ms.h
author Peter D. Barnes, Jr. <barnes26@llnl.gov>
Mon, 15 Jul 2013 14:19:57 -0700
changeset 9949 254133001f4f
parent 7386 2310ed220a61
child 11046 e62bccfbe56e
permissions -rw-r--r--
Fix strict aliasing warning.
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
#ifndef SYSTEM_WALL_CLOCK_MS_H
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
    22
#define SYSTEM_WALL_CLOCK_MS_H
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    24
#include <stdint.h>
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    25
16
99e833adbb46 change yans namespace to ns3
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 9
diff changeset
    26
namespace ns3 {
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
60
6672664e72bb add sample code for test, add doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 54
diff changeset
    28
/**
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    29
 * \brief measure elapsed time in milliseconds
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    30
 *
60
6672664e72bb add sample code for test, add doxygen doc
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 54
diff changeset
    31
 */
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
    32
class SystemWallClockMs {
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
public:
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    34
  SystemWallClockMs ();
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    35
  ~SystemWallClockMs ();
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    37
  /**
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    38
   * Start a measure.
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    39
   */
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    40
  void Start (void);
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    41
  /**
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    42
   * \brief Stop measuring the time since Start() was called.
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    43
   * \returns the measured elapsed wall clock time (in milliseconds) since 
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    44
   *          ns3::SystemWallClockMs::Start was invoked.
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    45
   *
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    46
   * It is possible to start a new measurement with ns3::SystemWallClockMs::Start
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    47
   * after this method returns.
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    48
   *
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    49
   * Returns int64_t to avoid dependency on clock_t in ns-3 code.
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    50
   */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    51
  int64_t End (void);
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    52
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    53
  /**
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    54
   * \returns the measured elapsed wall clock time (in milliseconds) since 
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    55
   *          ns3::SystemWallClockMs::Start was invoked.
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    56
   *
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    57
   * Returns int64_t to avoid dependency on clock_t in ns-3 code.
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    58
   */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    59
  int64_t GetElapsedReal (void) const;
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    60
  /**
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    61
   * \returns the measured elapsed 'user' wall clock time (in milliseconds) since 
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    62
   *          ns3::SystemWallClockMs::Start was invoked.
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    63
   *
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    64
   * Returns int64_t to avoid dependency on clock_t in ns-3 code.
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    65
   */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    66
  int64_t GetElapsedUser (void) const;
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    67
  /**
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    68
   * \returns the measured elapsed 'system' wall clock time (in milliseconds) since 
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    69
   *          ns3::SystemWallClockMs::Start was invoked.
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    70
   *
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    71
   * Returns int64_t to avoid dependency on clock_t in ns-3 code.
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    72
   */
5458
15fcd24f8b1e make win32 compile again
Craig Dowell <craigdo@ee.washington.edu>
parents: 5457
diff changeset
    73
  int64_t GetElapsedSystem (void) const;
5457
8cb18165e22f Apply Gustavo's patch for MinGW compatibiliy
Craig Dowell <craigdo@ee.washington.edu>
parents: 5441
diff changeset
    74
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
private:
150
663120712cd9 fix coding style
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 131
diff changeset
    76
  class SystemWallClockMsPrivate *m_priv;
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
};
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
7386
2310ed220a61 standardize ns-3 namespace declaration format
Vedran Miletić <rivanvx@gmail.com>
parents: 6821
diff changeset
    79
} // namespace ns3
9
2c31ae7c94db import from yans
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
34
f2aa05303e7c remove more unused files, rename system files
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 33
diff changeset
    81
#endif /* SYSTEM_WALL_CLOCK_MS_H */