Changeset 2653 for package_branches


Ignore:
Timestamp:
Dec 20, 2009, 7:35:08 PM (15 years ago)
Author:
broder
Message:

Remove the "checkpoint" code for timing measurements.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • package_branches/invirt-web/cherrypy/code/main.py

    r2652 r2653  
    130130    def list(self, result=None):
    131131        """Handler for list requests."""
    132         checkpoint.checkpoint('Getting list dict')
    133132        d = getListDict(cherrypy.request.login, cherrypy.request.state)
    134133        if result is not None:
    135134            d['result'] = result
    136         checkpoint.checkpoint('Got list dict')
    137135        return d
    138136    index=list
     
    291289                                          machine_id=machine_id).machine
    292290            d = infoDict(cherrypy.request.login, cherrypy.request.state, machine)
    293             checkpoint.checkpoint('Got infodict')
    294291            return d
    295292        index = info
     
    448445    machine = MachineView()
    449446
    450 class Checkpoint:
    451     def __init__(self):
    452         self.start_time = time.time()
    453         self.checkpoints = []
    454 
    455     def checkpoint(self, s):
    456         self.checkpoints.append((s, time.time()))
    457 
    458     def __str__(self):
    459         return ('Timing info:\n%s\n' %
    460                 '\n'.join(['%s: %s' % (d, t - self.start_time) for
    461                            (d, t) in self.checkpoints]))
    462 
    463 checkpoint = Checkpoint()
    464447
    465448class Defaults:
     
    495478def getListDict(username, state):
    496479    """Gets the list of local variables used by list.tmpl."""
    497     checkpoint.checkpoint('Starting')
    498480    machines = state.machines
    499     checkpoint.checkpoint('Got my machines')
    500481    on = {}
    501482    has_vnc = {}
    502483    installing = {}
    503484    xmlist = state.xmlist
    504     checkpoint.checkpoint('Got uptimes')
    505485    for m in machines:
    506486        if m not in xmlist:
     
    518498    max_memory = validation.maxMemory(username, state)
    519499    max_disk = validation.maxDisk(username)
    520     checkpoint.checkpoint('Got max mem/disk')
    521500    defaults = Defaults(max_memory=max_memory,
    522501                        max_disk=max_disk,
    523502                        owner=username)
    524     checkpoint.checkpoint('Got defaults')
    525503    def sortkey(machine):
    526504        return (machine.owner != username, machine.owner, machine.name)
     
    652630    """Get the variables used by info.tmpl."""
    653631    status = controls.statusInfo(machine)
    654     checkpoint.checkpoint('Getting status info')
    655632    has_vnc = hasVnc(status)
    656633    if status is None:
     
    666643        cpu_time_float = float(main_status.get('cpu_time', 0))
    667644        cputime = datetime.timedelta(seconds=int(cpu_time_float))
    668     checkpoint.checkpoint('Status')
    669645    display_fields = [('name', 'Name'),
    670646                      ('description', 'Description'),
     
    712688            #fields.append((disp, None))
    713689
    714     checkpoint.checkpoint('Got fields')
    715 
    716 
    717690    max_mem = validation.maxMemory(machine.owner, state, machine, False)
    718     checkpoint.checkpoint('Got mem')
    719691    max_disk = validation.maxDisk(machine.owner, machine)
    720692    defaults = Defaults()
     
    724696    defaults.type = machine.type.type_id
    725697    defaults.disk = "%0.2f" % (machine.disks[0].size/1024.)
    726     checkpoint.checkpoint('Got defaults')
    727698    d = dict(user=username,
    728699             on=status is not None,
Note: See TracChangeset for help on using the changeset viewer.