• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Recording the time a thread took to execute
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Recording the time a thread took to execute


  • Subject: Re: Recording the time a thread took to execute
  • From: Nick Zitzmann <email@hidden>
  • Date: Wed, 28 May 2003 15:16:03 -0700

On Wednesday, May 28, 2003, at 10:56 AM, Ken Tabb wrote:

I have an app which I'm developing to test various image processing algorithms, and how much of a difference the AltiVec / SMP optimisations made to it. The idea being so that our research group can evaluate different ways of parallelising a certain task, to see which offered best results (on G4 processors and "Apple's next" family of processors, if they change soon).

Whilst actual performance of the algorithms isn't important (in terms of how quickly the kernel schedules them and the clock time when they started/stopped), I'm very interested in how long a given thread took to operate (i.e. active CPU time during it's life).

Here's one way of doing it... (disclaimer - written in Mail, untested, use at your own risk, etc.)

#import <Carbon/Carbon.h>
#import <Cocoa/Cocoa.h>

- (void)someThreadedOperation
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
#ifdef SOMETHING
UInt32 ticks = TickCount();
#endif

// let your thread do its stuff...

#ifdef SOMETHING
NSLog(@"Time elapsed working in this thread: %f", (TickCount() - ticks) / 60.0);
#endif
[pool release];
}

Then just define SOMETHING (or whatever you call it) when you want to do a build that tests performance...

Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page: http://dreamless.home.attbi.com/

"Great spirits have always encountered violent opposition from mediocre minds." - Albert Einstein
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Follow-Ups:
    • Re: Recording the time a thread took to execute
      • From: Tom Sutcliffe <email@hidden>
References: 
 >Recording the time a thread took to execute (From: Ken Tabb <email@hidden>)

  • Prev by Date: Re: Newbie Question (alloc, init, retain?)
  • Next by Date: Re: Recording the time a thread took to execute
  • Previous by thread: Recording the time a thread took to execute
  • Next by thread: Re: Recording the time a thread took to execute
  • Index(es):
    • Date
    • Thread