windows-fs-memdump-20070919

add directory lookup stats to "fs memdump" output
This commit is contained in:
Jeffrey Altman 2007-09-20 04:54:14 +00:00
parent a186b0d65c
commit 87d87d33ea
6 changed files with 72 additions and 0 deletions

View File

@ -76,6 +76,8 @@ static void afsd_notifier(char *msgp, char *filep, long line)
buf_ForceTrace(TRUE);
afsi_log("--- begin dump ---");
cm_MemDumpDirStats(afsi_file, "a", 0);
cm_MemDumpBPlusStats(afsi_file, "a", 0);
cm_DumpCells(afsi_file, "a", 0);
cm_DumpVolumes(afsi_file, "a", 0);
cm_DumpSCache(afsi_file, "a", 0);

View File

@ -1743,6 +1743,44 @@ long cm_BPlusDirBuildTree(cm_scache_t *scp, cm_user_t *userp, cm_req_t* reqp)
return rc;
}
int cm_MemDumpBPlusStats(FILE *outputFile, char *cookie, int lock)
{
int zilch;
char output[128];
sprintf(output, "%s - B+ Lookup Hits: %-8d\r\n", cookie, bplus_lookup_hits);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Inexact Hits: %-8d\r\n", cookie, bplus_lookup_hits_inexact);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Ambiguous Hits: %-8d\r\n", cookie, bplus_lookup_ambiguous);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Misses: %-8d\r\n", cookie, bplus_lookup_misses);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Create: %-8d\r\n", cookie, bplus_create_entry);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Remove: %-8d\r\n", cookie, bplus_remove_entry);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Build Tree: %-8d\r\n", cookie, bplus_build_tree);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Free Tree: %-8d\r\n", cookie, bplus_free_tree);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - DV Error: %-8d\r\n", cookie, bplus_dv_error);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - B+ Time Lookup: %-16I64d\r\n", cookie, bplus_lookup_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Create: %-16I64d\r\n", cookie, bplus_create_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Remove: %-16I64d\r\n", cookie, bplus_remove_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Build: %-16I64d\r\n", cookie, bplus_build_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Free: %-16I64d\r\n", cookie, bplus_free_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
return(0);
}
void cm_BPlusDumpStats(void)
{
afsi_log("B+ Lookup Hits: %-8d", bplus_lookup_hits);

View File

@ -143,6 +143,7 @@ long cm_BPlusDirCreateEntry(cm_dirOp_t * op, char *entry, cm_fid_t * cfid);
int cm_BPlusDirDeleteEntry(cm_dirOp_t * op, char *entry);
long cm_BPlusDirBuildTree(cm_scache_t *scp, cm_user_t *userp, cm_req_t* reqp);
void cm_BPlusDumpStats(void);
int cm_MemDumpBPlusStats(FILE *outputFile, char *cookie, int lock);
extern afs_uint32 bplus_free_tree;
extern afs_uint32 bplus_dv_error;

View File

@ -36,6 +36,32 @@ afs_uint64 dir_enums = 0;
afs_int32 cm_BPlusTrees = 1;
int cm_MemDumpDirStats(FILE *outputFile, char *cookie, int lock)
{
int zilch;
char output[128];
sprintf(output, "%s - Dir Lookup Hits: %-8d\r\n", cookie, dir_lookup_hits);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Misses: %-8d\r\n", cookie, dir_lookup_misses);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Enums: %-8d\r\n", cookie, dir_enums);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Create: %-8d\r\n", cookie, dir_create_entry);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Remove: %-8d\r\n", cookie, dir_remove_entry);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Dir Times Lookup: %-16I64d\r\n", cookie, dir_lookup_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Create: %-16I64d\r\n", cookie, dir_create_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
sprintf(output, "%s - Remove: %-16I64d\r\n", cookie, dir_remove_time);
WriteFile(outputFile, output, (DWORD)strlen(output), &zilch, NULL);
return(0);
}
void cm_DirDumpStats(void)
{
afsi_log("Dir Lookup Hits: %-8d", dir_lookup_hits);

View File

@ -183,5 +183,8 @@ cm_DirEntryListFree(cm_dirEntryList_t ** list);
extern void
cm_DirDumpStats(void);
extern int
cm_MemDumpDirStats(FILE *outputFile, char *cookie, int lock);
extern afs_int64 dir_enums;
#endif /* __CM_DIR_ENV__ */

View File

@ -2706,6 +2706,8 @@ long cm_IoctlMemoryDump(struct smb_ioctl *ioctlp, struct cm_user *userp)
#endif
/* dump all interesting data */
cm_MemDumpDirStats(hLogFile, cookie, 1);
cm_MemDumpBPlusStats(hLogFile, cookie, 1);
cm_DumpCells(hLogFile, cookie, 1);
cm_DumpVolumes(hLogFile, cookie, 1);
cm_DumpSCache(hLogFile, cookie, 1);