mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <sha@pengutronix.de>
To: John Watts <contact@jookia.org>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] I2C: i.MX: early: Use internal udelay
Date: Tue, 31 Jan 2023 07:14:40 +0100	[thread overview]
Message-ID: <20230131061440.GU13319@pengutronix.de> (raw)
In-Reply-To: <Y9gPlWk6pCA6WnQ5@novena-choice-citizen>

On Tue, Jan 31, 2023 at 05:42:29AM +1100, John Watts wrote:
> On Mon, Jan 30, 2023 at 05:36:58PM +0100, Sascha Hauer wrote:
> > You can't disable MMU during runtime, but you can compile without MMU
> > support, just disable CONFIG_MMU. However, the early I2C code already
> > runs with MMU disabled, can't you just put in some test code there?
> 
> This is going to sound really silly but I'm not sure how to time the code
> without a clock. I guess grabserial?

You could udelay(10000000) and measure the time with a stopwatch.
That should be accurate enough for this purpose already, in the end
the time will differ anyway between SoCs.

If you want to measure more exactly we have this little perl script
which prints a timestamp for each line printed.

Sascha

------------------------8<----------------------

#! /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;
}


-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



  reply	other threads:[~2023-01-31  6:16 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26 18:56 John Watts
2023-01-30 10:27 ` Sascha Hauer
2023-01-30 10:42   ` John Watts
2023-01-30 12:17     ` Sascha Hauer
2023-01-30 12:24       ` John Watts
2023-01-30 12:31         ` Sascha Hauer
2023-01-30 12:56           ` John Watts
2023-01-30 16:36             ` Sascha Hauer
2023-01-30 18:42               ` John Watts
2023-01-31  6:14                 ` Sascha Hauer [this message]
2023-01-31  6:33                   ` John Watts
2023-02-02 14:21   ` Jules Maselbas
2023-02-02 14:27     ` Ahmad Fatoum
2023-02-01 17:50 ` Alexander Shiyan
2023-02-01 18:12   ` Jookia
2023-02-01 19:44   ` Ahmad Fatoum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230131061440.GU13319@pengutronix.de \
    --to=sha@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=contact@jookia.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox