~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/lsprof.py

Merge from bzr.dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
113
113
        :param format: 'txt' for a text representation;
114
114
            'callgrind' for calltree format;
115
115
            otherwise a pickled Python object. A format of None indicates
116
 
            that the format to use is to be found from the extension of
117
 
            filename.
 
116
            that the format to use is to be found from the filename. If
 
117
            the name starts with callgrind.out, callgrind format is used
 
118
            otherwise the format is given by the filename extension.
118
119
        """
119
120
        if format is None:
120
 
            ext = os.path.splitext(filename)[1]
121
 
            if len(ext) > 1:
122
 
                format = ext[1:]
 
121
            if filename.startswith('callgrind.out'):
 
122
                format = "callgrind"
 
123
            else:
 
124
                ext = os.path.splitext(filename)[1]
 
125
                if len(ext) > 1:
 
126
                    format = ext[1:]
123
127
        outfile = open(filename, 'wb')
124
128
        try:
125
129
            if format == "callgrind":