r14670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r14669‎ | r14670 | r14671 >
Date:23:13, 8 June 2006
Author:brion
Status:old
Tags:
Comment:
Use recording time, not start time, to ensure statistics time set is monotonic and we don't get spontaneously negative rates
Modified paths:
  • /trunk/mwsearch/Daemon/Daemon.cs (modified) (history)
  • /trunk/mwsearch/Daemon/Statistics.cs (modified) (history)
  • /trunk/mwsearch/Daemon/Worker.cs (modified) (history)

Diff [purge]

Index: trunk/mwsearch/Daemon/Daemon.cs
@@ -121,7 +121,7 @@
122122
123123 int threadCount = Worker.OpenCount;
124124 if (threadCount > maxWorkers) {
125 - stats.Add(false, DateTime.UtcNow, 0, threadCount);
 125+ stats.Add(false, 0, threadCount);
126126 log.Error("too many connections, skipping a request");
127127 } else {
128128 Worker worker = new Worker(client.GetStream(), config);
Index: trunk/mwsearch/Daemon/Worker.cs
@@ -358,7 +358,7 @@
359359
360360 void LogRequest(String searchterm, Query query, int numhits, DateTime start) {
361361 TimeSpan delta = DateTime.UtcNow - start;
362 - Daemon.stats.Add(true, start, delta.Milliseconds, OpenCount);
 362+ Daemon.stats.Add(true, delta.Milliseconds, OpenCount);
363363 log.InfoFormat("{0} {1}: query=[{2}] parsed=[{3}] hit=[{4}] in {5}ms",
364364 what, dbname, searchterm, query.ToString(), numhits, delta.Milliseconds);
365365 }
Index: trunk/mwsearch/Daemon/Statistics.cs
@@ -74,7 +74,7 @@
7575 return time.Ticks / 10000L;
7676 }
7777
78 - public void Add(bool status, DateTime time, long delta, int threads) {
 78+ public void Add(bool status, long delta, int threads) {
7979 lock (locker) {
8080 end++;
8181 if (end == maxItems)
@@ -87,7 +87,7 @@
8888 usedItems++;
8989 }
9090 handled[end] = status;
91 - times[end] = millis(time);
 91+ times[end] = millis(DateTime.UtcNow);
9292 deltas[end] = delta;
9393 activeThreads[end] = threads;
9494 }

Status & tagging log