CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    CPU time in Java

    Can anyone tell me how to calculate in Java the CPU time taken by a thread?


  2. #2
    Join Date
    May 1999
    Location
    Pune, MH, India.
    Posts
    453

    Re: CPU time in Java

    I didn't get the meaning of CPU time.
    Do u want to measure performance of the thread? If yes...

    Way 1:
    1) get the time-stamp before starting thread
    2) start thread and wait till thread stops
    3) get the time-stamp and compare it with the prev one

    Way 2:
    Assuming u do all the processing in 'run' method of the thread,
    1) get the time-stamp at the first line in 'run' method
    2) do all the processing
    3) get the time-stamp and compare it with the prev one

    If u don't want this, then I'm sorry.

    - UnicMan
    http://members.tripod.com/unicman

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured