(self)
return json.dumps({
            "name": self.description,
            "session": self.profile_session,
            "create_date": datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
            "init_stack_trace": _format_stack(self.init_stack_trace),
            "duration": self.duration,
            "collectors": {collector.name: collector.entries for collector in self.collectors},
        }, indent=4)
Utility function to generate a json version of this profiler.
        This is useful to write profiling entries into a file, such as::

            with Profiler(db=None) as profiler:
                do_stuff()

            filename = p.format_path('/home/foo/{desc}_{len}.json')
            with open(filename, 'w') as f:
                f.write(profiler.json())
Utility function to generate a json version of this profiler.
        This is useful to write profiling entries into a file, such as::
Utility function to generate a json version of this profiler . This is useful to write profiling entries into a file such as ::
def json(self):
        """
        Utility function to generate a json version of this profiler.
        This is useful to write profiling entries into a file, such as::

            with Profiler(db=None) as profiler:
                do_stuff()

            filename = p.format_path('/home/foo/{desc}_{len}.json')
            with open(filename, 'w') as f:
                f.write(profiler.json())
        """
        return json.dumps({
            "name": self.description,
            "session": self.profile_session,
            "create_date": datetime.datetime.now().strftime("%Y%m%d-%H%M%S"),
            "init_stack_trace": _format_stack(self.init_stack_trace),
            "duration": self.duration,
            "collectors": {collector.name: collector.entries for collector in self.collectors},
        }, indent=4)
def json ( self ) : return json . dumps ( { "name" : self . description , "session" : self . profile_session , "create_date" : datetime . datetime . now ( ) . strftime ( "%Y%m%d-%H%M%S" ) , "init_stack_trace" : _format_stack ( self . init_stack_trace ) , "duration" : self . duration , "collectors" : { collector . name : collector . entries for collector in self . collectors } , } , indent = 4 )