about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-15T09·33+0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2014-05-15T09·33+0200
commit84813af5b938246d9a4a785dfb08b86383ef62ae (patch)
tree15d15ea898fb643bcada061b41d78783e8010a14 /src
parent690adeb03de039551c4d8b5b4e7dda21c9c8f9b9 (diff)
nix-store --optimise: Remove bogus statistics
Diffstat (limited to 'src')
-rw-r--r--src/libstore/local-store.hh6
-rw-r--r--src/libstore/optimise-store.cc11
-rw-r--r--src/nix-store/nix-store.cc6
3 files changed, 9 insertions, 14 deletions
diff --git a/src/libstore/local-store.hh b/src/libstore/local-store.hh
index 487bb711ea5e..54331e448a94 100644
--- a/src/libstore/local-store.hh
+++ b/src/libstore/local-store.hh
@@ -34,14 +34,12 @@ struct Derivation;
 
 struct OptimiseStats
 {
-    unsigned long totalFiles;
-    unsigned long sameContents;
     unsigned long filesLinked;
     unsigned long long bytesFreed;
     unsigned long long blocksFreed;
     OptimiseStats()
     {
-        totalFiles = sameContents = filesLinked = 0;
+        filesLinked = 0;
         bytesFreed = blocksFreed = 0;
     }
 };
@@ -315,7 +313,7 @@ private:
 #endif
 
     InodeHash loadInodeHash();
-    Strings readDirectoryIgnoringInodes(const Path & path, const InodeHash & inodeHash, OptimiseStats & stats);
+    Strings readDirectoryIgnoringInodes(const Path & path, const InodeHash & inodeHash);
     void optimisePath_(OptimiseStats & stats, const Path & path, InodeHash & inodeHash);
 
     // Internal versions that are not wrapped in retry_sqlite.
diff --git a/src/libstore/optimise-store.cc b/src/libstore/optimise-store.cc
index 39b9e587a4fb..e43dbf31a854 100644
--- a/src/libstore/optimise-store.cc
+++ b/src/libstore/optimise-store.cc
@@ -39,6 +39,7 @@ struct MakeReadOnly
     }
 };
 
+
 LocalStore::InodeHash LocalStore::loadInodeHash()
 {
     printMsg(lvlDebug, "loading hash inodes in memory");
@@ -60,7 +61,8 @@ LocalStore::InodeHash LocalStore::loadInodeHash()
     return inodeHash;
 }
 
-Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHash & inodeHash, OptimiseStats & stats)
+
+Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHash & inodeHash)
 {
     Strings names;
 
@@ -73,7 +75,6 @@ Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHa
 
         if (inodeHash.count(dirent->d_ino)) {
             printMsg(lvlDebug, format("`%1%' is already linked") % dirent->d_name);
-            stats.totalFiles++;
             continue;
         }
 
@@ -86,6 +87,7 @@ Strings LocalStore::readDirectoryIgnoringInodes(const Path & path, const InodeHa
     return names;
 }
 
+
 void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHash & inodeHash)
 {
     checkInterrupt();
@@ -95,7 +97,7 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
         throw SysError(format("getting attributes of path `%1%'") % path);
 
     if (S_ISDIR(st.st_mode)) {
-        Strings names = readDirectoryIgnoringInodes(path, inodeHash, stats);
+        Strings names = readDirectoryIgnoringInodes(path, inodeHash);
         foreach (Strings::iterator, i, names)
             optimisePath_(stats, path + "/" + *i, inodeHash);
         return;
@@ -117,8 +119,6 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
         return;
     }
 
-    stats.totalFiles++;
-
     /* This can still happen on top-level files */
     if (st.st_nlink > 1 && inodeHash.count(st.st_ino)) {
         printMsg(lvlDebug, format("`%1%' is already linked, with %2% other file(s).") % path % (st.st_nlink - 2));
@@ -158,7 +158,6 @@ void LocalStore::optimisePath_(OptimiseStats & stats, const Path & path, InodeHa
     if (lstat(linkPath.c_str(), &stLink))
         throw SysError(format("getting attributes of path `%1%'") % linkPath);
 
-    stats.sameContents++;
     if (st.st_ino == stLink.st_ino) {
         printMsg(lvlDebug, format("`%1%' is already linked to `%2%'") % path % linkPath);
         return;
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index 341a4f6776f4..5da401c77fd2 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -801,11 +801,9 @@ static void opRepairPath(Strings opFlags, Strings opArgs)
 static void showOptimiseStats(OptimiseStats & stats)
 {
     printMsg(lvlError,
-        format("%1% freed by hard-linking %2% files; there are %3% files with equal contents out of %4% files in total")
+        format("%1% freed by hard-linking %2% files")
         % showBytes(stats.bytesFreed)
-        % stats.filesLinked
-        % stats.sameContents
-        % stats.totalFiles);
+        % stats.filesLinked);
 }