better saved memmory display

git-svn-id: https://svn.musicpd.org/mpd/trunk@2607 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2004-11-11 05:25:05 +00:00
parent 30ea485c63
commit 1d123cd496
4 changed files with 35 additions and 15 deletions

View File

@ -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,6 +278,31 @@ int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
*sum += (strlen(getDirectoryPath(dir))+1-sizeof(Directory *))*
dir->songs->numberOfNodes;
return 0;
}
int sumSavedFilenameMemoryInSong(FILE * fp, Song * song, void * data) {
int * sum = data;
*sum += strlen(song->url)+1;
return 0;
}
void printSavedMemoryFromFilenames() {
int sum = 0;
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;
@ -286,19 +311,11 @@ int sumSavedMemoryInDirectory(FILE * fp, Directory * dir, void * data) {
return 0;
}
int sumSavedMemoryInSong(FILE * fp, Song * song, void * data) {
int * sum = data;
*sum += strlen(song->url)+1;
void printSavedMemoryFromDirectoryNames() {
int sum = 0;
return 0;
}
traverseAllIn(stderr, NULL, NULL,
sumSavedDirectoryNameMemoryInDirectory, (void *)&sum);
void printSavedMemoryFromFilenames() {
int sum;
traverseAllIn(stderr, NULL, sumSavedMemoryInSong,
sumSavedMemoryInDirectory, (void *)&sum);
DEBUG("saved memory from filenames: %i\n", sum);
DEBUG("saved memory from directory names: %i\n", sum);
}

View File

@ -38,4 +38,6 @@ int listAllUniqueTags(FILE * fp, int type, int numConditiionals,
void printSavedMemoryFromFilenames();
void printSavedMemoryFromDirectoryNames();
#endif

View File

@ -433,6 +433,7 @@ int main(int argc, char * argv[]) {
printMemorySavedByTagTracker();
printSavedMemoryFromFilenames();
printSavedMemoryFromDirectoryNames();
daemonize(&options);

View File

@ -97,7 +97,7 @@ void printMemorySavedByTagTracker() {
}
}
DEBUG("saved memory: %li\n", (long)sum);
DEBUG("saved memory from tags: %li\n", (long)sum);
}
void sortTagTrackerInfo() {