[U-Boot] Profiling uboot

Ira W. Snyder iws at ovro.caltech.edu
Wed Jan 20 17:26:47 CET 2010


On Wed, Jan 20, 2010 at 09:51:57AM +0530, Basavaraj Dengi wrote:
> Hi,
> 
> I am trying to measure the time taken by uboot, from its init till
> it jumps to zImage[kernel].
> 
> Any suggestions as to which API's to be used for that?
> 
> Thanks in advance.
> 

I've used the attached ptx_ts script to measure U-Boot. It probably came
from this mailing list at some point.

Ira
-------------- next part --------------
#! /usr/bin/perl
#
# ptx_ts - Pengutronix' Add A Time Stamp Filter V1
# written by Wolfram Sang, Copyright 2009 Pengutronix
# free software - no warranty - WTFPL V2, see http://sam.zoy.org/wtfpl/

use warnings;
use strict;
use Time::HiRes qw(gettimeofday tv_interval);

my $arg = defined($ARGV[0]) ? $ARGV[0] : '(?=foo)bar'; # false-branch is a regexp that never matches
if ($arg eq '--help') {
	print "ptx_ts [regexp] - a filter which prepends a timestamp to every line of STDOUT; time will be reset if [regexp] matches\n";
	print "  Example: microcom <microcom_options> | ptx_ts 'U-Boot 2.0'\n";
	exit 0;
}

my $old;
my $base;
$| = 1; # Flush output immediately

sub reset_time {
	$old = 0;
	$base = [gettimeofday()];
}

reset_time;
while (<STDIN>) {
	reset_time if (/$arg/o);
	my $new = tv_interval($base);
	my $diff = $new - $old;
	printf("[%10.6f] <%10.6f> $_", $new, $diff);
	$old = $new;
}


More information about the U-Boot mailing list