blob: 56a70bdfaed7504048790a0c21401cb10cbea80f [file] [log] [blame]
Vince Lehmanb8b18062015-07-14 13:07:22 -05001# -*- Mode:python; c-file-style:"gnu"; indent-tabs-mode:nil -*- */
2#
Alexander Lane9944cf52018-05-17 12:16:50 -05003# Copyright (C) 2015-2018, The University of Memphis,
Ashlesh Gawandeda475f02017-03-01 17:20:58 -06004# Arizona Board of Regents,
5# Regents of the University of California.
Vince Lehmanb8b18062015-07-14 13:07:22 -05006#
7# This file is part of Mini-NDN.
8# See AUTHORS.md for a complete list of Mini-NDN authors and contributors.
9#
10# Mini-NDN is free software: you can redistribute it and/or modify
11# it under the terms of the GNU General Public License as published by
12# the Free Software Foundation, either version 3 of the License, or
13# (at your option) any later version.
14#
15# Mini-NDN is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18# GNU General Public License for more details.
19#
20# You should have received a copy of the GNU General Public License
21# along with Mini-NDN, e.g., in COPYING.md file.
22# If not, see <http://www.gnu.org/licenses/>.
ashu34c3ee02015-03-25 14:41:14 -050023
24from ndn.experiments.experiment import Experiment
25
26import time
27
28class PingallExperiment(Experiment):
29
Vince Lehman3b8bc652015-06-18 15:01:47 -050030 def __init__(self, args):
ashu34c3ee02015-03-25 14:41:14 -050031
Vince Lehman3b8bc652015-06-18 15:01:47 -050032 Experiment.__init__(self, args)
ashu34c3ee02015-03-25 14:41:14 -050033 self.COLLECTION_PERIOD_BUFFER = 10
Ashlesh Gawande27b5e1b2018-08-06 17:47:15 -050034 print "Using {} traffic".format(self.options.pctTraffic)
35
36 def setup(self):
37 if self.options.nPings != 0:
38 Experiment.setup(self)
ashu34c3ee02015-03-25 14:41:14 -050039
40 def run(self):
Ashlesh Gawande27b5e1b2018-08-06 17:47:15 -050041 if self.options.nPings == 0:
42 return
43
Ashlesh Gawanded9c9e522015-10-15 16:40:12 -050044 self.startPctPings()
ashu34c3ee02015-03-25 14:41:14 -050045
46 # For pingall experiment sleep for the number of pings + some offset
Ashlesh Gawande27b5e1b2018-08-06 17:47:15 -050047 time.sleep(self.options.nPings + self.COLLECTION_PERIOD_BUFFER)
Vince Lehman3b8bc652015-06-18 15:01:47 -050048
49Experiment.register("pingall", PingallExperiment)