[SM-Commit] GIT changes to master sorcery by Jaka Kranjc (55a4f4efb0bcc163e07e9fae650ba317b6329f39)

Jaka Kranjc scm at sourcemage.org
Sun Jul 19 11:53:03 EDT 2009


GIT changes to master sorcery by Jaka Kranjc <lynxlynxlynx at sourcemage.org>:

 ChangeLog                       |    3 +++
 var/lib/sorcery/modules/libtime |   11 +++++++----
 2 files changed, 10 insertions(+), 4 deletions(-)

New commits:
commit 55a4f4efb0bcc163e07e9fae650ba317b6329f39
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    libtime: moved a block of code in compute_mean, so it is run only when needed

commit db2f60ba250fc338622447e96cc57712c2ce882e
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    libtime: added n to the output of --full

commit 6fa5c9af92da8240187ed23e055310f896fcc5d0
Author: Jaka Kranjc <lynxlynxlynx at sourcemage.org>
Commit: Jaka Kranjc <lynxlynxlynx at sourcemage.org>

    libtime: fixed the verbosity check for --full

diff --git a/ChangeLog b/ChangeLog
index 26d53b2..3a44456 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,9 @@
 	  by ruskie #15269
 	* resurrect: consistently only dispel the target if there is a cache we
 	  can resurrect later
+	* libtime: fixed the verbosity check for --full
+	  added the number of samples to the output of --full
+	  moved a block of code in compute_mean, so it is run only when needed
 
 2009-05-27 Jaka Kranjc <lynxlynxlynx at sourcemage.org>
 	* dl_git: fixed syntax error
diff --git a/var/lib/sorcery/modules/libtime b/var/lib/sorcery/modules/libtime
index 8804548..b995878 100755
--- a/var/lib/sorcery/modules/libtime
+++ b/var/lib/sorcery/modules/libtime
@@ -92,7 +92,7 @@ function compute_all_cast_times() {
   times=$(compute_cast_times $spell)
   [[ -z $times ]] && return 1
 
-  if [[ $verbosity == 0 ]]; then
+  if [[ $verbosity == false ]]; then
     echo -n $spell:
     echo "$times" | tail -n 1
     echo -n $spell:
@@ -101,6 +101,7 @@ function compute_all_cast_times() {
     echo "$times" | compute_mean
     echo -n $spell:
     echo "$times" | compute_weighted_mean last-cast $(private_installed_version $spell)
+    echo -n $spell:n $(wc -l <<< "$times")
     echo
   else
     message -n "Last cast time of ${SPELL_COLOR}$spell$DEFAULT_COLOR: "
@@ -118,6 +119,8 @@ function compute_all_cast_times() {
     message -n "Weighted mean cast time of ${SPELL_COLOR}$spell$DEFAULT_COLOR: "
     time=$(echo "$times" | compute_weighted_mean last-cast $(private_installed_version $spell))
     pretty_print_time $time
+
+    message "Number of samples: $(wc -l <<< "$times")"
     echo
   fi
 
@@ -139,12 +142,12 @@ function compute_mean() {
     END {
       if (n == 0) exit
       mean = sum/n;
-      for (i in numbers) {
-        variance += (numbers[i] - mean)^2;
-      }
       if (n == 1) {
         error = 0;
       } else {
+        for (i in numbers) {
+          variance += (numbers[i] - mean)^2;
+        }
         error = int(sqrt(variance/(n-1)/n)*1.96 + 0.5);
       }
 



More information about the SM-Commit mailing list