linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Surovegin <ebs@ebshome.net>
To: Yang <yangqs@163.com>
Cc: linuxppc-embedded@lists.linuxppc.org
Subject: Re: clock() seems not work !
Date: Sun, 15 Feb 2004 21:14:35 -0800	[thread overview]
Message-ID: <20040216051435.GA25104@gate.ebshome.net> (raw)
In-Reply-To: <200402160354.VAA15020@lists.linuxppc.org>


On Mon, Feb 16, 2004 at 11:58:07AM +0800, Yang wrote:
>
>  i am writting applications based ppc+MVL3.0, which i want to get CPU
> time,but clock() seems not work for me, for this i did a simple test,as
> follows:
> /*----------------*/
>   while(1)
> 	{
>       printf("current time is %ld \n",clock());
> 	  sleep(1);
> 	}
> /*----------------*/
>      But it printed the same value all the while. How is it?
>

What do you expect from this function?

Did you read manual entry for clock()?

On POSIX systems clock() returns (number of seconds * CLOCKS_PER_SEC)
spent by the process, not a system time/tick count...

Your program is doing _nothing_, so it's normal that clock() returns
the same number. Change sleep(1) to some busy loop and you'll see the
difference.

Eugene.

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

       reply	other threads:[~2004-02-16  5:14 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200402160354.VAA15020@lists.linuxppc.org>
2004-02-16  5:14 ` Eugene Surovegin [this message]
2004-02-16  7:20 clock() seems not work ! Eugene Surovegin

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=20040216051435.GA25104@gate.ebshome.net \
    --to=ebs@ebshome.net \
    --cc=linuxppc-embedded@lists.linuxppc.org \
    --cc=yangqs@163.com \
    /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;
as well as URLs for NNTP newsgroup(s).