Project

General

Profile

Revision 707

Collect some statistics when converting a SWF file to LWF.

View differences:

commands.py
21 21
from haizea.core.configfile import HaizeaConfig, HaizeaMultiConfig
22 22
from haizea.core.accounting import AccountingDataCollection
23 23
from haizea.common.config import ConfigException
24
from haizea.common.stats import percentile
24 25
from haizea.cli.optionparser import Option
25 26
from haizea.cli import Command
26 27
from mx.DateTime import TimeDelta, Parser
......
482 483
                                         help = """
483 484
                                         Memory requested by jobs.
484 485
                                         """))
486
        self.optparser.add_option(Option("-s", "--scale", action="store", type="string", dest="scale",
487
                                         help = """
488
                                         Scale number of processors by 1/SCALE.
489
                                         """))        
485 490
                
486 491
    def run(self):            
487 492
        self.parse_options()
......
502 507
        time = TimeDelta(seconds=0)
503 508
        requests = ET.SubElement(root, "lease-requests")
504 509
        
510
        slowdowns = []
511
        users = set()
505 512
        
506 513
        infile = open(infile, "r")
507 514
        for line in infile:
......
629 636
                        # Job was submitted to a queue we're filtering out
630 637
                        continue              
631 638
        
639
                if self.opt.scale != None:
640
                    num_processors_requested = int(num_processors_requested/int(self.opt.scale))
641
                    
632 642
                # Make submission time relative to starting time of trace
633 643
                submit_time = submit_time - from_time
634 644
        
......
662 672
                else:
663 673
                    print "Cannot convert this file. Job #%i does not specify requested memory, and --memory parameter not specified" % job_number
664 674
                    exit(-1)
675
                    
676
                if run_time < 10:
677
                    run_time2 = 10
678
                else:
679
                    run_time2 = run_time
680
                slowdown = wait_time + run_time2 / float(run_time2)
681
                slowdowns.append(slowdown)
665 682
                
683
                if not user_id in users:
684
                    users.add(user_id)
685
                
666 686
                start = ET.SubElement(lease, "start")
667 687
                #lease.set("preemptible", self.opt.preemptible)
668 688
                lease.set("user", `user_id`)
......
694 714
                attr.set("value", `exec_number`)
695 715
                    
696 716
        tree = ET.ElementTree(root)
697
        print ET.tostring(root)
717
        
718
        outfile = open(outfile, "w")
719
        tree.write(outfile)
720
        
721
        infile.close()
722
        outfile.close()
723
        
724
        slowdowns.sort()
698 725

  
726
        print "SLOWDOWNS"
727
        print "---------"
728
        print "min: %.2f" % slowdowns[0]
729
        print "10p: %.2f" % percentile(slowdowns, 0.1)
730
        print "25p: %.2f" % percentile(slowdowns, 0.25)
731
        print "med: %.2f" % percentile(slowdowns, 0.5)
732
        print "75p: %.2f" % percentile(slowdowns, 0.75)
733
        print "90p: %.2f" % percentile(slowdowns, 0.9)
734
        print "max: %.2f" % slowdowns[-1]
735
        print 
736
        print "USERS"
737
        print "-----"
738
        print "Number of users: %i" % len(users)
699 739

  

Also available in: Unified diff