🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7336

Re: Measure Time

#7336
From: Ronald Wildenberg
Date: Wed, 27 Jun 2001 13:18
42 lines
1726 bytes
Hi,

The easiest way I see to do it is to call System.currentTimeMillis()
before the method call and after the method call and subtract the
two times.

Like this:
long timeBefore = System.currentTimeMillis();
outputClient1.write(a, 0, c);
long timeAfter = System.currentTimeMillis();
long methodDuration = timeAfter - timeBefore;

Ronald.


Shoo wrote:

> Hello~
>
> I wanna measure how long does a meathod take to finish its function.
>
> For example, the following meathod
>
>                    outputClient1.write(a, 0 ,c);
>
> What should I put  between the meathod?
>
> Or, is there any timeing function for measuring time?
>
> Class Timestamp?
>
> Thanks for your reply.
>
> I do appreicate!
>
> Best regards,
>
> Shoo
>
> PS: By the way, is there any nice web resourse which give a piece of code to
> show the basic function of each class?
>       Thanks~
Technical Details
Message-ID: <3B39DD22.D89397AA@tryllian.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews
References: <3b39d5d1_2@dnews>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,f5ad0b6dba6ad7b0
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-06-27 06:18:52 PST
Message-ID: <3B39DD22.D89397AA@tryllian.com>
Date: Wed, 27 Jun 2001 15:18:26 +0200
From: Ronald Wildenberg <ronald@tryllian.com>
X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U)
X-Accept-Language: en
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language
Subject: Re: Measure Time
References: <3b39d5d1_2@dnews>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 212.0.243.10
X-Trace: dnews 993647666 212.0.243.10 (27 Jun 2001 06:14:26 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!dnews