English 中文(简体)
Measure the run time in pascal program [closed]
原标题:
Closed. This question needs to be more focused. It is not currently accepting answers.

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 5 years ago.

Please, I need to measure the search time in my pascal program in order to measure the performance efficient.. if there is any function or code to measure the search time?

thanks

问题回答

Try this

uses DateUtils;
var
  FromTime, ToTime: TDateTime;
  DiffMinutes: Integer;
begin
  FromTime := Now;

  // do your process

  ToTime := Now;
  DiffMinutes := MinutesBetween(ToTime,FromTime);
end;

It didnt work for me either, because Free Pascal dont find the "Now"-Function..

I just add "uses sysutils" in Bharats Answer and it works fine for me!

like:

uses DateUtils, sysutils;
var
  FromTime, ToTime: TDateTime;
  DiffMinutes: Integer;
begin
  FromTime := Now;

  // do your process

  ToTime := Now;
  DiffMinutes := MinutesBetween(ToTime,FromTime);
end;




相关问题
How to store only time; not date and time?

In one field I need to store not a datetime pair, i.e. a standard Oracle date. 01/10/2009 22:10:39 But time only 22:10:39 I think that save disk space (I have 2 million rows) or provide faster ...

Auto Fill the Time in infopath

I would like to know if there is a way that I can have the time be auto filled when the user enters 10 I then want it to show 10:00. how can I do this?

Regex for timestamps in php

I m trying to take timestamps in this format: 2009-11-16T14:05:22-08:00 and make turn them into something like 2009-11-16 How do I remove everything after the "T"?

Segmentation fault on time(0);

I m rewriting an old program to do some new stuff, and suddenly I get a segmentation fault error on the following line of code: time_t seconds_since_time_begun = time(0); Why, oh why? Update: I ...

Run a PHP script every second using CLI

I have a dedicated server running Cent OS with a Parallel PLESK panel. I need to run a PHP script every second to update my database. These is no alternative way time-wise, it needs to be updated ...

热门标签