def GetHtmlStateDetails(self, k, v, detailed):
        import htmlwriter
        if k == 'cachedObjects':
            if detailed:
                hd = [
                    'ObjectID', 'Time Stamp', 'Version', 'Shared', 'NodeID',
                    'Size'
                ]
                li = []
                for ik, iv in v.iteritems():
                    l = '???'
                    if iv.pickle:
                        l = '%d' % len(iv.pickle)
                        if iv.compressed:
                            l += ' (compressed)'
                    li.append([
                        iv.objectID,
                        util.FmtDateEng(iv.version[0]), iv.version[1],
                        iv.shared, iv.nodeID, l
                    ])

                return ('Object Cache',
                        htmlwriter.GetTable(hd, li, useFilter=True))
            else:
                return ('Object Cache', '%d entries' % len(v))
        elif k == 'cachedObjectReturnStatistics':
            if detailed:
                hd = ['ObjectID', 'Count', 'Bytes']
                li = []
                for ik, iv in v.iteritems():
                    if type(ik) == types.TupleType and len(
                            ik) == 2 and ik[0] in sm.services:
                        ik = '%s::%s' % ik
                    li.append([htmlwriter.Swing(str(ik)), iv[0], iv[1]])

                li.sort()
                return ('Object Cache Statistics',
                        htmlwriter.GetTable(hd, li, useFilter=True))
            else:
                totCalls = 0
                totBytes = 0
                for each in v.itervalues():
                    totCalls += each[0]
                    totBytes += each[1]

                return (
                    'Object Cache Statistics',
                    '%d distinct objects returned via %d calls, totalling %d bytes'
                    % (len(v), totCalls, totBytes))
Пример #2
0
    def GetHtmlStateDetails(self, k, v, detailed):
        import htmlwriter
        if k == 'socket':
            if detailed:
                hd = []
                li = []
                li.append(['Listen Port', 80])
                return (k, htmlwriter.GetTable(hd, li, useFilter=True))
        elif k == 'counters':
            if detailed:
                hd = ['Name',
                 'Value',
                 'Parent',
                 'Filename',
                 'Log Channel']
                li = []
                for each in self.counters:
                    li.append([each.name,
                     each.counter,
                     each.parent,
                     each.filename,
                     each.logChannel])

                return (k, htmlwriter.GetTable(hd, li, useFilter=True))
            else:
                v = ''
                comma = ''
                for each in self.counters:
                    v = v + comma + each.name + '=' + strx(each.counter)
                    comma = ', '

                return (k, v)
        else:
            if k == 'countersInterval':
                desc = 'The time in secounds between logging counter values, assuming that counter logging is started in the first place.'
                if self.logStart:
                    desc = 'Thus as the service is currently configured, %d seconds will pass between each log operation' % v
                else:
                    desc = 'Thus if you would enable counter logging, %d seconds would pass between each log operation as the service is currently configured.' % v
                return ('Counter Interval', desc)
            if k == 'logStart':
                desc = 'Whether or not counter logging should be started up when the service is started.  If 0, then logging will not be started, otherwise it will be.  '
                if v:
                    desc = desc + 'The counter service is currently configured in such a manner that logging will be started'
                else:
                    desc = desc + 'The counter service is currently configured in such a manner that logging will <b>not</b> be started'
                return ('Start Logging?', desc)