Re: timing functions and chunks of code in *nix?

  • From: "Martin Slack" <m.g.slack@xxxxxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Tue, 8 Feb 2011 16:25:20 -0000

Hi Ty,

Look at the time function. So time ls will give you some information about real, user and system times consumed by ls..

 Martin


----- Original Message ----- From: "Littlefield, Tyler" <tyler@xxxxxxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Tuesday, February 08, 2011 3:56 PM
Subject: timing functions and chunks of code in *nix?


Hello all,
I know windows exposes high-resolution timers to do this sorta thing, but I'm curious how I could do the same in Linux? Is there something that will give me timing in ms? so:
prev = gettime();
myfunc();
now = gettime();
printf("you spent %d ms.\n", prev-now);

--

Thanks,
Ty

__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind


__________
View the list's information and change your settings at //www.freelists.org/list/programmingblind

Other related posts: