|
From: Gabriele B. <g.b...@co...> - 2002-08-09 17:12:48
|
Ciao guys, I was wondering about the usefulness of a template variable for showing the effective execution time of the query. Am I wrong or we don't have it? <if yes you are welcome to come here and crucify me - I have not done much of a research on ht://Dig source code> Ciao and have a nice week-end guys! -Gabriele --=20 Gabriele Bartolini - Web Programmer Comune di Prato - Prato - Tuscany - Italy g.b...@co... | http://www.comune.prato.it > find bin/laden -name osama -exec rm {} ; |
|
From: Gilles D. <gr...@sc...> - 2002-08-13 02:49:25
|
According to Gabriele Bartolini: > I was wondering about the usefulness of a template variable for > showing the effective execution time of the query. > > Am I wrong or we don't have it? <if yes you are welcome to come here > and crucify me - I have not done much of a research on ht://Dig source > code> As far as I know, there isn't anything like that in the code right now, and it does sound like it could be useful, especially in testing. -- Gilles R. Detillieux E-mail: <gr...@sc...> Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/ Dept. Physiology, U. of Manitoba Winnipeg, MB R3E 3J7 (Canada) |
|
From: Gabriele B. <g.b...@co...> - 2002-08-13 09:54:57
|
> As far as I know, there isn't anything like that in the code right now, > and it does sound like it could be useful, especially in testing. I put it in the 3.1.x branch. Please check whether everything sounds good for you, and I'll put it into the main branch as well. I hope I did not make any disaster when committing to this branch. There are 2 considerations I think we may pay attention to: - I included the <sys/time.h> file for the gettimeofday function: should we change the configure file? - I created the template variable EXECUTIONTIME, which displays the time in a "seconds.milliseconds" format (like Google). Give a look at the Display::setExecutionTime method. If everything is fine, we should put it into the documentation as well. Please let me know if it works fine. I applied this patch to our Web site and it works pretty well and really nicely! :-) Ciao and thanks -Gabriele --=20 Gabriele Bartolini - Web Programmer Comune di Prato - Prato - Tuscany - Italy g.b...@co... | http://www.comune.prato.it > find bin/laden -name osama -exec rm {} ; |
|
From: Gilles D. <gr...@sc...> - 2002-08-13 15:50:27
|
According to Gabriele Bartolini: > > As far as I know, there isn't anything like that in the code right now, > > and it does sound like it could be useful, especially in testing. > > I put it in the 3.1.x branch. Please check whether everything sounds > good for you, and I'll put it into the main branch as well. > > I hope I did not make any disaster when committing to this branch. Well, technically, the 3.1.x is under a permanent feature freeze, so any such feature additions, as opposed to bug fixes, should really go to a vote by the developers. I know I haven't always followed that freeze myself, but I've gotten away with this because I was essentially the one person making or reviewing all changes since 3.1.3. However, due to the bugs I inadvertently introduced into 3.1.6 because of all the new features, it was really my hope that 3.1.7, when I can find the time to work on it, would be bug fixes only and no new features unless really sorely needed. I don't see anything technically wrong with your code, but I am concerned about the portability of the gettimeofday() call and timeval structure. Is this sure to be supported on all platforms 3.1.x currently supports, including Cygwin? > There are 2 considerations I think we may pay attention to: > - I included the <sys/time.h> file for the gettimeofday function: should > we change the configure file? Well, I was going to suggest at least testing HAVE_SYS_TIME_H, if not also TIME_WITH_SYS_TIME, as htdig/Document.h and htlib/lib.h do, but I see that htlib/Connection.cc doesn't check either before including sys/time.h, so you're not breaking anything that's not already broken. For the sake of completeness, though, it may be a good idea to fix this in both htsearch.cc and Connection.cc. I think a configure test for gettimeofday is pretty much essential, though. > - I created the template variable EXECUTIONTIME, which displays the time > in a "seconds.milliseconds" format (like Google). Give a look at the > Display::setExecutionTime method. If everything is fine, we should put > it into the documentation as well. > > Please let me know if it works fine. I applied this patch to our Web > site and it works pretty well and really nicely! :-) Again, I'm a bit concerned about the portabality of snprintf() in setExecutionTime(). The db code in 3.1.x seems to go through contortions to avoid problems with systems that don't have it, and the htdig 3.2 code seems to go through similar efforts, providing an alternate function in htlib, for systems that lack it. If we don't do this in 3.1.x, I think we're asking for compatibility/portability problems. So, I need to ask, is this one little feature worth all this extra effort to support it reliably in 3.1.x? For now, I vote... -1 The 3.2 code is another story, as snprintf and gettimeofday are already used elsewhere in the code (and presumably gettimeofday is provided if missing, or it's not an issue (yet)), and 3.2 isn't under a feature freeze. So, go nuts on 3.2, but please tread ever so carefully on the 3.1.x branch. It's not the place to be testing new features, IMHO, unless you make a good case for it. -- Gilles R. Detillieux E-mail: <gr...@sc...> Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/ Dept. Physiology, U. of Manitoba Winnipeg, MB R3E 3J7 (Canada) |
|
From: Gabriele B. <g.b...@co...> - 2002-08-13 16:43:26
|
> The 3.2 code is another story, as snprintf and gettimeofday are already > used elsewhere in the code (and presumably gettimeofday is provided if > missing, or it's not an issue (yet)), and 3.2 isn't under a feature freez= e. > So, go nuts on 3.2, but please tread ever so carefully on the 3.1.x branc= h. > It's not the place to be testing new features, IMHO, unless you make a go= od > case for it. Sorry guys for putting this into the 3.1.x code. I completely agree with you Gilles. Portability is much much more important than a small and frivolous feature such execution time. Sorry again! -Gabriele --=20 Gabriele Bartolini - Web Programmer Comune di Prato - Prato - Tuscany - Italy g.b...@co... | http://www.comune.prato.it > find bin/laden -name osama -exec rm {} ; |
|
From: Jim C. <gre...@yg...> - 2002-08-13 19:35:59
|
Gabriele Bartolini's bits of 13 Aug 2002 translated to: >> The 3.2 code is another story, as snprintf and gettimeofday are already >> used elsewhere in the code (and presumably gettimeofday is provided if >> missing, or it's not an issue (yet)), and 3.2 isn't under a feature freeze. >> So, go nuts on 3.2, but please tread ever so carefully on the 3.1.x branch. >> It's not the place to be testing new features, IMHO, unless you make a good >> case for it. > >Sorry guys for putting this into the 3.1.x code. I completely agree with >you Gilles. Portability is much much more important than a small and >frivolous feature such execution time. I agree with not adding this to the 3.1.x code, but it would be great if you could make a 3.1.6 patch available :) Jim |
|
From: Gilles D. <gr...@sc...> - 2002-08-13 19:55:44
|
According to Jim Cole:
> I agree with not adding this to the 3.1.x code, but it would be
> great if you could make a 3.1.6 patch available :)
That's easy enough...
This patch shows the effective execution time of an htsearch query,
in seconds.
Tue Aug 13 11:44:01 CEST 2002 Gabriele Bartolini <an...@us...>
* htsearch/Display.[h,cc]: added execution time feature (EXECUTIONTIME
template variable)
* htsearch/htsearch.cc: calculates the execution time through
'gettimeofday'
--- htsearch/Display.h.orig Thu Nov 1 16:23:32 2001
+++ htsearch/Display.h Tue Aug 13 10:26:24 2002
@@ -40,6 +40,7 @@ public:
void setLogicalWords(char *);
void setOriginalWords(char *);
void setCGI(cgi *);
+ void setExecutionTime(int milliseconds);
void display(int pageNumber);
void displayMatch(ResultMatch *, int current);
@@ -147,6 +148,11 @@ protected:
TemplateList templates;
Template *currentTemplate;
+ //
+ // Execution time
+ //
+ String execution_time;
+
//
// Methods...
//
@@ -220,6 +226,20 @@ inline void
Display::setCGI(cgi *aCgi)
{
input = aCgi;
+}
+
+inline void
+Display::setExecutionTime(int milliseconds)
+{
+ if (milliseconds > 0)
+ {
+ char value[8];
+ snprintf(value, 8, "%.2f", (float) milliseconds / 1000);
+
+ execution_time << value;
+ }
+ else
+ execution_time = '?'; // very unlikely to happen
}
#endif
--- htsearch/Display.cc.orig Wed Jan 16 23:00:17 2002
+++ htsearch/Display.cc Tue Aug 13 09:49:08 2002
@@ -30,6 +30,7 @@ extern int debug;
//*****************************************************************************
//
Display::Display(char *indexFile, char *docFile)
+: execution_time(0)
{
docIndex = Database::getDatabaseInstance();
docIndex->OpenRead(indexFile);
@@ -434,6 +435,7 @@ Display::setVariables(int pageNumber, Li
vars.Add("ENDYEAR", new String(config["endyear"]));
vars.Add("ENDMONTH", new String(config["endmonth"]));
vars.Add("ENDDAY", new String(config["endday"]));
+ vars.Add("EXECUTIONTIME", new String(execution_time));
String *str;
char *format = input->get("format");
--- htsearch/htsearch.cc.orig Fri Jan 18 Jan 21:59:47 2002
+++ htsearch/htsearch.cc Tue Aug 13 Aug 09:49:08 2002
@@ -21,6 +21,7 @@ static char RCSid[] = "$Id: htsearch.cc,
#include "WordList.h"
#include "StringList.h"
#include "IntObject.h"
+#include <sys/time.h>
#include <time.h>
#include <ctype.h>
#include <signal.h>
@@ -70,6 +71,8 @@ main(int ac, char **av)
StringMatch searchWordsPattern;
StringList requiredWords;
int i;
+ struct timeval start_time, end_time;
+ gettimeofday(&start_time, 0); // Set the start time
//
// Parse command line arguments
@@ -338,6 +341,7 @@ main(int ac, char **av)
filenamemsg.get()));
return 0;
}
+
display.setOriginalWords(originalWords);
display.setResults(results);
display.setSearchWords(&searchWords);
@@ -346,6 +350,15 @@ main(int ac, char **av)
display.setAllWordsPattern(&searchWordsPattern);
display.setCGI(&input);
display.setLogicalWords(logicalWords);
+
+ // Set the execution time in milliseconds
+ gettimeofday(&end_time, 0); // Set the end time
+
+ // Pass it to the display object
+ display.setExecutionTime( (int) (
+ ((end_time.tv_sec - start_time.tv_sec) * 1000) // seconds in milliseconds
+ + ((float)(end_time.tv_usec - start_time.tv_usec) / 1000))); // microseconds in milliseconds
+
if (parser->hadError())
display.displaySyntaxError(parser->getErrorMessage());
else
@@ -353,6 +366,7 @@ main(int ac, char **av)
delete results;
delete parser;
+
return 0;
}
--
Gilles R. Detillieux E-mail: <gr...@sc...>
Spinal Cord Research Centre WWW: http://www.scrc.umanitoba.ca/
Dept. Physiology, U. of Manitoba Winnipeg, MB R3E 3J7 (Canada)
|
|
From: Joe R. J. <jj...@cl...> - 2002-08-13 20:27:50
|
On Tue, 13 Aug 2002, Gilles Detillieux wrote:
> Date: Tue, 13 Aug 2002 14:55:14 -0500 (CDT)
> From: Gilles Detillieux <gr...@sc...>
> To: Jim Cole <gre...@yg...>
> Cc: "ht://Dig - Dev" <htd...@li...>
> Subject: Re: [htdig-dev] Feature: Execution time
>
> According to Jim Cole:
> > I agree with not adding this to the 3.1.x code, but it would be
> > great if you could make a 3.1.6 patch available :)
>
> That's easy enough...
>
> This patch shows the effective execution time of an htsearch query,
> in seconds.
>
> Tue Aug 13 11:44:01 CEST 2002 Gabriele Bartolini <an...@us...>
>
> * htsearch/Display.[h,cc]: added execution time feature (EXECUTIONTIME
> template variable)
> * htsearch/htsearch.cc: calculates the execution time through
> 'gettimeofday'
Great;) It's in
ftp://ftp.ccsf.org/htdig-patches/3.1.6/ExecutionTime.0
Incidentally, here is the patch download statistics as of today:
Tue Aug 13 13:24:18 PDT 2002
ssl.9 174
timet_enddate.1 165
documentation.1 65
Makefile.0 63
metadate.0 60
redirect.0 50
documentation.2 48
NUL.0 46
AdjustableLoggingPatch.tar.gz 42
fileSpace.1 36
titleSpace.0 35
multiple-noindex.1 33
Date-viewing.0 30
time_t.0 25
gcc-3.1.0 20
ExternalParser-max_doc_size.0 5
htnotifyNull.0 3
ExecutionTime.0 0
Regards,
Joe
--
_/ _/_/_/ _/ ____________ __o
_/ _/ _/ _/ ______________ _-\<,_
_/ _/ _/_/_/ _/ _/ ......(_)/ (_)
_/_/ oe _/ _/. _/_/ ah jj...@cl...
|