Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing one data file with throughput multiple flows #21

Open
natale-p opened this issue Mar 11, 2014 · 3 comments
Open

Printing one data file with throughput multiple flows #21

natale-p opened this issue Mar 11, 2014 · 3 comments
Labels

Comments

@natale-p
Copy link

Actually, if I have 3 flows and want to plot their throughput, I need to run 3 times captcp, using each time a different -f parameter .

What about adding a range capability for the -f parameter ? The output .dat file will be something like

Time Throughput flow 1 Throughput flow 2
0.0 0.0 0.0
1.0 100.0 85.0
2.0 120.0 95.0

.....

Thank you

@hgn
Copy link
Owner

hgn commented Mar 11, 2014

-f

Mhh, ok. But this needs some major rewriting of the code. Any patches?

@natale-p
Copy link
Author

diff --git i/captcp.py w/captcp.py
index a63f71a..0644442 100755
--- i/captcp.py
+++ w/captcp.py
@@ -2699,10 +2699,14 @@ class ThroughputMod(Mod):

 def initialize(self):
     self.parse_local_options()
  •    self.end_time = self.start_time = False
    
  •    self.start_time = {}
    
  •    self.end_time = {}
    
  •    self.last_sample = {}
    
  •    self.data = {}
    
  •    self.output_row = {}
     self.total_data_len = 0
     self.time_clipping_delta = 0.0
    
  •    self.first_packet_seen = None
    
  •    self.first_packet_seen = []
     if not self.opts.stdio:
         # no need to check and generate Gnuplot
         # environment
    

    @@ -2791,11 +2795,29 @@ class ThroughputMod(Mod):
    (self.opts.unit, self.opts.samplelength))
    self.logger.warning("Use --per-second (-p) option if you want per-second average")

  • def output_data(self, time, amount):

  •    if self.opts.stdio:
    
  •        sys.stdout.write("%5.1f  %10.1f\n" % (time, amount))
    
  •    else:
    
  •        self.throughput_file.write("%.5f %.8f\n" % (time, amount))
    
  • def output_data(self, connection_id, time, amount):

  •    if time not in self.output_row:
    
  •        self.output_row[time] = {}
    
  •    self.output_row[time][connection_id] = amount
    
  •    if len(self.output_row[time]) == len(self.ids):
    
  •        fmt = '{} '
    
  •        for i in range(0, len(self.ids)):
    
  •            fmt += '{} '
    
  •        fmt += '\n'
    
  •        values = (str(time),)
    
  •        for c_id in range(1, len(self.ids)+1):
    
  •            values = values + (str(self.output_row[time][c_id]),)
    
  •        if self.opts.stdio:
    
  •            sys.stdout.write(fmt.format(*values))
    
  •        else:
    
  •            self.throughput_file.write(fmt.format(*values))
    
  •        del self.output_row[time]
    

Initial patch.

Problem: it breaks backward compatibility, and not works without -f .
Suggestions?

@hgn
Copy link
Owner

hgn commented Mar 19, 2014

Mhh, I will think about this! Thank you

@hgn hgn added the feature label Mar 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants