def report_result(self, profile, environ, start, stop, outpath):
        thread_ident = thread.get_ident()
        ts_parts = map(lambda x: str(int(x)), divmod(start, 100000))
        outpath = os.path.join(self.outpath, ts_parts[0], ts_parts[1])
        outfile_base = (self.reqnum, thread_ident) % '%s-%s'

        if not os.path.exists(outpath):
            os.makedirs(outpath)

        profile.dump_stats(os.path.join(outpath, outfile_base + '.profile'))

        with open(os.path.join(outpath, outfile_base + '.json'), 'w') as fp:
            fp.write(simplejson.dumps({
                'environ': dict((k, v) for k, v in environ.iteritems() if isinstance(v, basestring)),
                'start_time': start,
                'stop_time': stop,
                'request_number': self.reqnum,
                'thread_ident': thread_ident,
                'hostname': self.hostname,
            }, indent=2))
dataset/ETHPy150Open disqus/django-perftools/perftools/middleware/remoteprof.py/RemoteProfilingMiddleware.report_result/swapped operands of `%`