예제 #1
0
def write_time( cpu_times, emphasise=False ):

    def write( text ):
        if not emphasise:
            sys.stdout.write( text )
        else:
            sys.stdout.write( as_emphasised( text ) )

    write( " Time:" )
    write( " Wall [ {}".format( emphasise_time_by_digit( as_duration_string( cpu_times.wall ) ) ) )
    write( " ] CPU [ {}".format( emphasise_time_by_digit( as_duration_string( cpu_times.process ) ) ) )
    write( " ] CPU/Wall [ {}".format( as_colour( 'time', as_wall_cpu_percent_string( cpu_times ) ) ) )
    write( " ]" )
예제 #2
0
def write_time(cpu_times, emphasise=False):
    def write(text):
        if not emphasise:
            sys.stdout.write(text)
        else:
            sys.stdout.write(as_emphasised(text))

    write(" Time:")
    write(" Wall [ {}".format(
        emphasise_time_by_digit(as_duration_string(cpu_times.wall))))
    write(" ] CPU [ {}".format(
        emphasise_time_by_digit(as_duration_string(cpu_times.process))))
    write(" ] CPU/Wall [ {}".format(
        as_colour('time', as_wall_cpu_percent_string(cpu_times))))
    write(" ]")
예제 #3
0
파일: html_report.py 프로젝트: j0nnyw/cuppa
 def _time_string(cls, nanoseconds):
     time_text = cuppa.timer.as_duration_string(nanoseconds)
     return emphasise_time_by_digit(
         time_text,
         start_colour=" ",
         start_highlight='<span class="font-weight-bold">',
         end_highlight='</span>')
예제 #4
0
 def _time_string( cls, nanoseconds ):
     time_text = cuppa.timer.as_duration_string( nanoseconds )
     return emphasise_time_by_digit(
         time_text,
         start_colour=" ",
         start_highlight='<span class="font-weight-bold">',
         end_highlight='</span>'
     )
예제 #5
0
    def __write_time(self, results):
        sys.stdout.write(" Time:")

        if 'wall_duration' in results:
            sys.stdout.write(" Wall [ %s ]" %
                             emphasise_time_by_digit(results['wall_duration']))

        sys.stdout.write(" CPU [ %s ]" %
                         emphasise_time_by_digit(results['cpu_duration']))

        if 'wall_cpu_percent' in results:
            wall_cpu_percent = results['wall_cpu_percent'].upper()
            format = "%6s%%"
            if wall_cpu_percent == "N/A":
                format = "%5s  "
            wall_cpu_percent = format % wall_cpu_percent
            sys.stdout.write(" CPU/Wall [ %s ]" %
                             as_colour('time', wall_cpu_percent))
    def __write_time( self, results ):
        sys.stdout.write( " Time:" )

        if 'wall_duration' in results:
            sys.stdout.write(
                " Wall [ %s ]" % emphasise_time_by_digit( results['wall_duration'] )
            )

        sys.stdout.write(
            " CPU [ %s ]" % emphasise_time_by_digit( results['cpu_duration'] )
        )

        if 'wall_cpu_percent' in results:
            wall_cpu_percent = results['wall_cpu_percent'].upper()
            format = "%6s%%"
            if wall_cpu_percent == "N/A":
                format = "%5s  "
            wall_cpu_percent = format % wall_cpu_percent
            sys.stdout.write(
                " CPU/Wall [ %s ]" % as_colour( 'time', wall_cpu_percent )
            )
예제 #7
0
파일: timer.py 프로젝트: brianfpeters/cuppa
def as_string( cpu_times ):
    return "Time: Wall [ {} ] CPU [ {} ] CPU/Wall [ {} ]".format(
            emphasise_time_by_digit( as_duration_string( cpu_times.wall ) ),
            emphasise_time_by_digit( as_duration_string( cpu_times.process ) ),
            as_colour( 'time', as_wall_cpu_percent_string( cpu_times ) )
    )