Logo Search packages:      
Sourcecode: namebench version File versions  Download package

def libnamebench::benchmark::Benchmark::SaveResultsToCsv (   self,
  filename 
)

Write out a CSV file with detailed results on each request.

Args:
  filename: full path on where to save results (string)

Sample output:
nameserver, test_number, test, type, duration, answer_count, ttl

Definition at line 358 of file benchmark.py.

00358                                       :
    """Write out a CSV file with detailed results on each request.

    Args:
      filename: full path on where to save results (string)

    Sample output:
    nameserver, test_number, test, type, duration, answer_count, ttl
    """
    self.msg("Opening %s for write" % filename, debug=True)
    csv_file = open(filename, 'w')
    output = csv.writer(csv_file)
    output.writerow(['IP', 'Name', 'Check Duration', 'Test #', 'Record',
                     'Record Type', 'Duration', 'TTL', 'Answer Count',
                     'Response'])
    for ns in self.results:
      self.msg("Saving detailed data for %s" % ns, debug=True)
      for (test_run, test_results) in enumerate(self.results[ns]):
        for (record, req_type, duration, response, error_msg) in test_results:
          answer_text = ''
          answer_count = -1
          ttl = -1
          if response:
            if response.answer:
              answer_count = len(response.answer)
              ttl = response.answer[0].ttl
            answer_text = ns.ResponseToAscii(response)
          output.writerow([ns.ip, ns.name, ns.check_duration, test_run, record,
                           req_type, duration, ttl, answer_count, answer_text, error_msg])
    csv_file.close()
    self.msg("%s saved." % filename, debug=True)



Generated by  Doxygen 1.6.0   Back to index