--- a/SConstruct Mon Sep 04 12:23:44 2006 +0200
+++ b/SConstruct Mon Sep 04 12:28:04 2006 +0200
@@ -531,10 +531,8 @@
common.add_sources ([
'buffer.cc',
'mac-address-factory.cc',
- 'static-position.cc',
'chunk.cc',
'mac-network-interface.cc',
- 'static-speed-position.cc',
'chunk-constant-data.cc',
'packet.cc',
'tags.cc',
@@ -543,10 +541,8 @@
'chunk-utils.cc',
'pcap-writer.cc',
'trace-container.cc',
- 'population-analysis.cc',
'traced-variable-test.cc',
'ipv4-address.cc',
- 'position.cc',
'trace-stream-test.cc',
'ipv4-network-interface.cc',
'utils.cc',
@@ -572,18 +568,14 @@
'chunk-utils.h',
'llc-snap-encapsulation.h',
'mac-network-interface.h',
- 'population-analysis.h',
- 'position.h',
'trace-stream.h',
'pcap-writer.h',
'mac-address-factory.h',
- 'static-position.h',
'utils.h'
])
common.add_headers ([
'chunk-llc-snap.h',
'ref-ptr.h',
- 'static-speed-position.h'
])
--- a/src/common/population-analysis.cc Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-#include <cassert>
-#include <math.h>
-
-#include "population-analysis.h"
-
-/* This code is a C++ translation of Java code released under the GPLv2
- copyright Mathieu Lacage in treegrowth-stable:
- http://cutebugs.net/code/treegrowth-stable.
- */
-
-namespace ns3 {
-
-PopulationAnalysis::PopulationAnalysis ()
-{
- reset ();
-}
-PopulationAnalysis::~PopulationAnalysis ()
-{}
-
-void
-PopulationAnalysis::reset (void)
-{
- m_n = 0;
- m_square_sum = 0.0;
- m_mean = 0.0;
- m_sum = 0.0;
-}
-
-void
-PopulationAnalysis::add_term (double term)
-{
- double d = (term - m_mean);
- m_n++;
- m_mean += d / m_n;
- m_square_sum += d * (term - m_mean);
- m_sum += term;
-}
-
-uint32_t
-PopulationAnalysis::get_n (void)
-{
- return m_n;
-}
-double
-PopulationAnalysis::get_total (void)
-{
- return m_sum;
-}
-double
-PopulationAnalysis::get_mean (void)
-{
- return m_mean;
-}
-double
-PopulationAnalysis::get_standard_deviation (void)
-{
- if (m_n == 0) {
- return 0.0;
- }
- assert (get_unbiased_variance () >= 0);
- double deviation = sqrt (get_unbiased_variance ());
- return deviation;
-}
-double
-PopulationAnalysis::get_unbiased_variance (void)
-{
- if (m_n == 1 || m_n == 0) {
- return 0.0;
- }
- return m_square_sum / (m_n - 1);
-}
-
-}; // namespace ns3
--- a/src/common/population-analysis.h Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2005 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-
-
-#ifndef POPULATION_ANALYSIS_H
-#define POPULATION_ANALYSIS_H
-
-#include <stdint.h>
-
-namespace ns3 {
-
-class PopulationAnalysis {
-public:
- PopulationAnalysis ();
- ~PopulationAnalysis ();
-
- void reset (void);
-
- void add_term (double term);
-
- uint32_t get_n (void);
- double get_total (void);
- double get_mean (void);
- double get_standard_deviation (void);
- double get_unbiased_variance (void);
-
-private:
- double m_mean;
- double m_square_sum;
- double m_sum;
- uint32_t m_n;
-};
-
-}; // namespace ns3
-
-
-#endif /* POPULATION_ANALYSIS_H */
--- a/src/common/position.cc Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "position.h"
-#include <math.h>
-
-namespace ns3 {
-
-Position::~Position ()
-{}
-
-void
-Position::get (double &x, double &y, double &z) const
-{
- real_get (x,y,z);
-}
-double
-Position::get_distance_from (Position const*position) const
-{
- double ox,oy,oz;
- double x,y,z;
- position->real_get (ox,oy,oz);
- real_get (x,y,z);
- double dx = ox - x;
- double dy = oy - y;
- double dz = oz - z;
- return sqrt (dx*dx+dy*dy+dz*dz);
-}
-
-}; // namespace ns3
--- a/src/common/position.h Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef POSITION_H
-#define POSITION_H
-
-namespace ns3 {
-
-class Position {
-public:
- virtual ~Position () = 0;
-
- void get (double &x, double &y, double &z) const;
- double get_distance_from (Position const*position) const;
-private:
- virtual void real_get (double &x, double &y, double &z) const = 0;
-};
-
-}; // namespace ns3
-
-#endif /* POSITION_H */
--- a/src/common/static-position.cc Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-position.h"
-
-namespace ns3 {
-
-StaticPosition::StaticPosition ()
- : m_x (0.0), m_y (0.0), m_z (0.0)
-{}
-StaticPosition::~StaticPosition ()
-{}
-
-void
-StaticPosition::set (double x, double y, double z)
-{
- m_x = x;
- m_y = y;
- m_z = z;
-}
-void
-StaticPosition::real_get (double &x, double &y, double &z) const
-{
- x = m_x;
- y = m_y;
- z = m_z;
-}
-
-}; // namespace ns3
--- a/src/common/static-position.h Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_POSITION_H
-#define STATIC_POSITION_H
-
-#include "position.h"
-
-namespace ns3 {
-
-class StaticPosition : public Position {
-public:
- StaticPosition ();
- virtual ~StaticPosition ();
-
- void set (double x, double y, double z);
-private:
- virtual void real_get (double &x, double &y, double &z) const;
- double m_x;
- double m_y;
- double m_z;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_POSITION_H */
--- a/src/common/static-speed-position.cc Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#include "static-speed-position.h"
-#include "ns3/simulator.h"
-
-namespace ns3 {
-
-StaticSpeedPosition::StaticSpeedPosition ()
- : m_x (0.0),
- m_y (0.0),
- m_z (0.0),
- m_dx (0.0),
- m_dy (0.0),
- m_dz (0.0),
- m_prev_us (0)
-{}
-StaticSpeedPosition::~StaticSpeedPosition ()
-{}
-
-void
-StaticSpeedPosition::set (double x, double y, double z)
-{
- m_x = x;
- m_y = y;
- m_z = z;
-}
-
-void
-StaticSpeedPosition::set_delta (double dx, double dy, double dz)
-{
- m_dx = dx / 1000000;
- m_dy = dy / 1000000;
- m_dz = dz / 1000000;
-}
-
-void
-StaticSpeedPosition::real_get (double &x, double &y, double &z) const
-{
- uint64_t now_us = Simulator::now ().us ();
- uint64_t delta_us = now_us - m_prev_us;
- m_x += m_dx * delta_us;
- m_y += m_dy * delta_us;
- m_z += m_dz * delta_us;
- m_prev_us = now_us;
- x = m_x;
- y = m_y;
- z = m_z;
-}
-
-}; // namespace ns3
--- a/src/common/static-speed-position.h Mon Sep 04 12:23:44 2006 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/* -*- Mode:C++; c-basic-offset:8; tab-width:8; indent-tabs-mode:t -*- */
-/*
- * Copyright (c) 2006 INRIA
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation;
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
- */
-#ifndef STATIC_SPEED_POSITION_H
-#define STATIC_SPEED_POSITION_H
-
-#include <stdint.h>
-#include "position.h"
-
-namespace ns3 {
-
-class StaticSpeedPosition : public Position {
-public:
- StaticSpeedPosition ();
- virtual ~StaticSpeedPosition ();
-
- // m
- void set (double x, double y, double z);
- // m/s
- void set_delta (double dx, double dy, double dz);
-private:
- virtual void real_get (double &x, double &y, double &z) const;
- mutable double m_x;
- mutable double m_y;
- mutable double m_z;
- double m_dx;
- double m_dy;
- double m_dz;
- mutable uint64_t m_prev_us;
-};
-
-}; // namespace ns3
-
-#endif /* STATIC_SPEED_POSITION */
--- a/src/core/system-wall-clock-ms.h Mon Sep 04 12:23:44 2006 +0200
+++ b/src/core/system-wall-clock-ms.h Mon Sep 04 12:28:04 2006 +0200
@@ -19,22 +19,22 @@
* Author: Mathieu Lacage <mathieu.lacage.inria.fr>
*/
-#ifndef WALL_CLOCK_MS_H
-#define WALL_CLOCK_MS_H
+#ifndef SYSTEM_WALL_CLOCK_MS_H
+#define SYSTEM_WALL_CLOCK_MS_H
namespace ns3 {
-class WallClockMs {
+class SystemWallClockMs {
public:
- WallClockMs ();
- ~WallClockMs ();
+ SystemWallClockMs ();
+ ~SystemWallClockMs ();
void start (void);
unsigned long long end (void);
private:
- class WallClockMsPrivate *m_priv;
+ class SystemWallClockMsPrivate *m_priv;
};
}; // namespace ns3
-#endif /* WALL_CLOCK_MS_H */
+#endif /* SYSTEM_WALL_CLOCK_MS_H */
--- a/src/core/unix-system-wall-clock-ms.cc Mon Sep 04 12:23:44 2006 +0200
+++ b/src/core/unix-system-wall-clock-ms.cc Mon Sep 04 12:28:04 2006 +0200
@@ -19,12 +19,12 @@
* Author: Mathieu Lacage <mathieu.lacage.inria.fr>
*/
-#include "wall-clock-ms.h"
+#include "system-wall-clock-ms.h"
#include <sys/time.h>
namespace ns3 {
-class WallClockMsPrivate {
+class SystemWallClockMsPrivate {
public:
void start (void);
unsigned long long end (void);
@@ -34,14 +34,14 @@
};
void
-WallClockMsPrivate::start (void)
+SystemWallClockMsPrivate::start (void)
{
struct timezone tz;
gettimeofday (&m_start_tv, &tz);
}
unsigned long long
-WallClockMsPrivate::end (void)
+SystemWallClockMsPrivate::end (void)
{
struct timezone tz;
gettimeofday (&m_end_tv, &tz);
@@ -50,23 +50,23 @@
return end - start;
}
-WallClockMs::WallClockMs ()
- : m_priv (new WallClockMsPrivate ())
+SystemWallClockMs::SystemWallClockMs ()
+ : m_priv (new SystemWallClockMsPrivate ())
{}
-WallClockMs::~WallClockMs ()
+SystemWallClockMs::~SystemWallClockMs ()
{
delete m_priv;
m_priv = 0;
}
void
-WallClockMs::start (void)
+SystemWallClockMs::start (void)
{
m_priv->start ();
}
unsigned long long
-WallClockMs::end (void)
+SystemWallClockMs::end (void)
{
return m_priv->end ();
}
--- a/src/core/win32-system-wall-clock-ms.cc Mon Sep 04 12:23:44 2006 +0200
+++ b/src/core/win32-system-wall-clock-ms.cc Mon Sep 04 12:28:04 2006 +0200
@@ -19,11 +19,11 @@
* Author: Mathieu Lacage <mathieu.lacage.inria.fr>
*/
-#include "wall-clock-ms.h"
+#include "system-wall-clock-ms.h"
namespace ns3 {
-class WallClockMsPrivate {
+class SystemWallClockMsPrivate {
public:
void start (void);
unsigned long long end (void);
@@ -31,33 +31,33 @@
};
void
-WallClockMsPrivate::start (void)
+SystemWallClockMsPrivate::start (void)
{
}
unsigned long long
-WallClockMsPrivate::end (void)
+SystemWallClockMsPrivate::end (void)
{
return 0;
}
-WallClockMs::WallClockMs ()
- : m_priv (new WallClockMsPrivate ())
+SystemWallClockMs::SystemWallClockMs ()
+ : m_priv (new SystemWallClockMsPrivate ())
{}
-WallClockMs::~WallClockMs ()
+SystemWallClockMs::~SystemWallClockMs ()
{
delete m_priv;
m_priv = 0;
}
void
-WallClockMs::start (void)
+SystemWallClockMs::start (void)
{
m_priv->start ();
}
unsigned long long
-WallClockMs::end (void)
+SystemWallClockMs::end (void)
{
return m_priv->end ();
}
--- a/utils/bench-simulator.cc Mon Sep 04 12:23:44 2006 +0200
+++ b/utils/bench-simulator.cc Mon Sep 04 12:28:04 2006 +0200
@@ -20,7 +20,7 @@
*/
#include "ns3/simulator.h"
-#include "ns3/wall-clock-ms.h"
+#include "ns3/system-wall-clock-ms.h"
#include <iostream>
#include <fstream>
#include <vector>
@@ -68,7 +68,7 @@
void
Bench::bench (void)
{
- WallClockMs time;
+ SystemWallClockMs time;
double init, simu;
time.start ();
for (std::vector<uint64_t>::const_iterator i = m_distribution.begin ();