aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbUtils.c
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 /src/dbUtils.c
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 'src/dbUtils.c')
-rw-r--r--src/dbUtils.c37
1 files changed, 27 insertions, 10 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);
+}