Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Mustapha Bihmouten
  Where is Mustapha Bihmouten?
 Casablanca
 Morocco
 Mustapha Bihmouten
 To: Nilson Rishi
  Where is Nilson Rishi?
 Bangkok
 Thailand
 Nilson Rishi
 Tags
Subject: RE: display execution time
Thread ID: 288850 Message ID: 288857 # Views: 40 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Projects and Design
Date: Friday, December 24, 2010 4:30:21 PM         
   


> Expert,
>
> With SYS(3054), VFP could display messages on screen about the optimization level. I want it to display the execution time for my SELECT-SQL command, how?
>
> Regards,
> Nilson

Hello Nilson

This code will save execution time and showPlan into a txt file
the use of a text file allow you to add execution time (that is not possible on screen)

*-------- Start here ------------------------------------
Local lcRushmorePlan As String, ltStartTime As Datetime

*--- turn on optimization (12 for Join and Filter levels)
=Sys(3054, 12, "lcRushmorePlan")

*--- read Start time
m.ltStartTime = Datetime()

*---- your query
Select ... From ... left Join ... On ... Where ... Into Cursor MyCursor

*--- write result to a text file
Strtofile( Transform( DateTime()- m.ltStartTime) + Chr(13) + m.lcRushmorePlan, 'RushmorePlan.txt')

*--- Turn off
=Sys( 3054, 0)

*--- close all tables
Close Databases All

*--- free memory
Release lcRushmorePlan, ltStartTime

*--- finally check result
Modify File RushmorePlan.txt Nowait
*----------------- EOF ------------------------------------


Regards
Mustapha Bihmouten

ENTIRE THREAD

display execution time Posted by Nilson Rishi @ 12/24/2010 2:59:44 PM
RE: display execution time Posted by Mustapha Bihmouten @ 12/24/2010 4:30:21 PM
RE: display execution time Posted by Nilson Rishi @ 12/25/2010 5:55:33 AM
RE: display execution time Posted by Samir H. @ 12/24/2010 4:46:47 PM
RE: display execution time Posted by Nilson Rishi @ 12/25/2010 5:56:05 AM