Changeset 2731


Ignore:
Timestamp:
Dec 20, 2009, 9:48:13 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-rebased/code/main.py

    r2730 r2731  
    125125    def list(self, result=None):
    126126        """Handler for list requests."""
    127         checkpoint.checkpoint('Getting list dict')
    128127        d = getListDict(cherrypy.request.login, cherrypy.request.state)
    129128        if result is not None:
    130129            d['result'] = result
    131         checkpoint.checkpoint('Got list dict')
    132130        return d
    133131    index=list
     
    286284                                          machine_id=machine_id).machine
    287285            d = infoDict(cherrypy.request.login, cherrypy.request.state, machine)
    288             checkpoint.checkpoint('Got infodict')
    289286            return d
    290287        index = info
     
    394391    machine = MachineView()
    395392
    396 class Checkpoint:
    397     def __init__(self):
    398         self.start_time = time.time()
    399         self.checkpoints = []
    400 
    401     def checkpoint(self, s):
    402         self.checkpoints.append((s, time.time()))
    403 
    404     def __str__(self):
    405         return ('Timing info:\n%s\n' %
    406                 '\n'.join(['%s: %s' % (d, t - self.start_time) for
    407                            (d, t) in self.checkpoints]))
    408 
    409 checkpoint = Checkpoint()
    410393
    411394class Defaults:
     
    441424def getListDict(username, state):
    442425    """Gets the list of local variables used by list.tmpl."""
    443     checkpoint.checkpoint('Starting')
    444426    machines = state.machines
    445     checkpoint.checkpoint('Got my machines')
    446427    on = {}
    447428    has_vnc = {}
    448429    installing = {}
    449430    xmlist = state.xmlist
    450     checkpoint.checkpoint('Got uptimes')
    451431    for m in machines:
    452432        if m not in xmlist:
     
    464444    max_memory = validation.maxMemory(username, state)
    465445    max_disk = validation.maxDisk(username)
    466     checkpoint.checkpoint('Got max mem/disk')
    467446    defaults = Defaults(max_memory=max_memory,
    468447                        max_disk=max_disk,
    469448                        owner=username)
    470     checkpoint.checkpoint('Got defaults')
    471449    def sortkey(machine):
    472450        return (machine.owner != username, machine.owner, machine.name)
     
    598576    """Get the variables used by info.tmpl."""
    599577    status = controls.statusInfo(machine)
    600     checkpoint.checkpoint('Getting status info')
    601578    has_vnc = hasVnc(status)
    602579    if status is None:
     
    612589        cpu_time_float = float(main_status.get('cpu_time', 0))
    613590        cputime = datetime.timedelta(seconds=int(cpu_time_float))
    614     checkpoint.checkpoint('Status')
    615591    display_fields = [('name', 'Name'),
    616592                      ('description', 'Description'),
     
    658634            #fields.append((disp, None))
    659635
    660     checkpoint.checkpoint('Got fields')
    661 
    662 
    663636    max_mem = validation.maxMemory(machine.owner, state, machine, False)
    664     checkpoint.checkpoint('Got mem')
    665637    max_disk = validation.maxDisk(machine.owner, machine)
    666638    defaults = Defaults()
     
    670642    defaults.type = machine.type.type_id
    671643    defaults.disk = "%0.2f" % (machine.disks[0].size/1024.)
    672     checkpoint.checkpoint('Got defaults')
    673644    d = dict(user=username,
    674645             on=status is not None,
Note: See TracChangeset for help on using the changeset viewer.