aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-11-11 05:25:05 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-11-11 05:25:05 +0000
commit1d123cd496bd9c01586dcb8d75f48fc3c5e74532 (patch)
tree4dc12c2eefe47b0ac9d69cd70aa097c9b8971be1
parent30ea485c63566686e9fd85bb4a50b7b1c4db04a7 (diff)
downloadmpd-1d123cd496bd9c01586dcb8d75f48fc3c5e74532.tar.gz
mpd-1d123cd496bd9c01586dcb8d75f48fc3c5e74532.tar.xz
mpd-1d123cd496bd9c01586dcb8d75f48fc3c5e74532.zip
better saved memmory display
git-svn-id: https://svn.musicpd.org/mpd/trunk@2607 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to '')
-rw-r--r--src/dbUtils.c37
-rw-r--r--src/dbUtils.h2
-rw-r--r--src/main.c1
-rw-r--r--src/tagTracker.c2
4 files changed, 31 insertions, 11 deletions
diff --git a/src/dbUtils.c b/src/dbUtils.c
index 51e991130..60344a291 100644
--- a/src/dbUtils.c
+++ b/src/dbUtils.c
@@ -270,7 +270,7 @@ int listAllUniqueTags(FILE * fp, int type, int numConditionals,
return ret;
}
-int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
+int sumSavedFilenameMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
int * sum = data;
if(!dir->name) return 0;
@@ -278,15 +278,10 @@ int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
*sum += (strlen(getDirectoryPath(dir))+1-sizeof(Directory *))*
dir->songs->numberOfNodes;
- *sum += (strlen(getDirectoryPath(dir))+1)*
- dir->subDirectories->numberOfNodes;
-
- *sum += strlen(dir->name)+1;
-
return 0;
}
-int sumSavedMemoryInSong(FILE * fp, Song * song, void * data) {
+int sumSavedFilenameMemoryInSong(FILE * fp, Song * song, void * data) {
int * sum = data;
*sum += strlen(song->url)+1;
@@ -295,10 +290,32 @@ int sumSavedMemoryInSong(FILE * fp, Song * song, void * data) {
}
void printSavedMemoryFromFilenames() {
- int sum;
+ int sum = 0;
- traverseAllIn(stderr, NULL, sumSavedMemoryInSong,
- sumSavedMemoryInDirectory, (void *)&sum);
+ traverseAllIn(stderr, NULL, sumSavedFilenameMemoryInSong,
+ sumSavedFilenameMemoryInDirectory, (void *)&sum);
DEBUG("saved memory from filenames: %i\n", sum);
}
+
+int sumSavedDirectoryNameMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
+ int * sum = data;
+
+ if(!dir->name) return 0;
+
+ *sum += (strlen(getDirectoryPath(dir))+1)*
+ dir->subDirectories->numberOfNodes;
+
+ *sum += strlen(dir->name)+1;
+
+ return 0;
+}
+
+void printSavedMemoryFromDirectoryNames() {
+ int sum = 0;
+
+ traverseAllIn(stderr, NULL, NULL,
+ sumSavedDirectoryNameMemoryInDirectory, (void *)&sum);
+
+ DEBUG("saved memory from directory names: %i\n", sum);
+}
diff --git a/src/dbUtils.h b/src/dbUtils.h
index df5a71656..a24311a5a 100644
--- a/src/dbUtils.h
+++ b/src/dbUtils.h
@@ -38,4 +38,6 @@ int listAllUniqueTags(FILE * fp, int type, int numConditiionals,
void printSavedMemoryFromFilenames();
+void printSavedMemoryFromDirectoryNames();
+
#endif
diff --git a/src/main.c b/src/main.c
index e1b711890..62c3a7626 100644
--- a/src/main.c
+++ b/src/main.c
@@ -433,6 +433,7 @@ int main(int argc, char * argv[]) {
printMemorySavedByTagTracker();
printSavedMemoryFromFilenames();
+ printSavedMemoryFromDirectoryNames();
daemonize(&options);
diff --git a/src/tagTracker.c b/src/tagTracker.c
index 1fe599d79..b7608ed97 100644
--- a/src/tagTracker.c
+++ b/src/tagTracker.c
@@ -97,7 +97,7 @@ void printMemorySavedByTagTracker() {
}
}
- DEBUG("saved memory: %li\n", (long)sum);
+ DEBUG("saved memory from tags: %li\n", (long)sum);
}
void sortTagTrackerInfo() {