diff options
Diffstat (limited to 'src/app.c')
-rw-r--r-- | src/app.c | 18 |
1 files changed, 15 insertions, 3 deletions
@@ -882,13 +882,25 @@ const iString *debugInfo_App(void) { | |||
882 | extern char **environ; /* The environment variables. */ | 882 | extern char **environ; /* The environment variables. */ |
883 | iApp *d = &app_; | 883 | iApp *d = &app_; |
884 | iString *msg = collectNew_String(); | 884 | iString *msg = collectNew_String(); |
885 | iObjectList *docs = iClob(listDocuments_App(NULL)); | ||
885 | format_String(msg, "# Debug information\n"); | 886 | format_String(msg, "# Debug information\n"); |
887 | appendFormat_String(msg, "## Memory usage\n"); { | ||
888 | iMemInfo total = { 0, 0 }; | ||
889 | iForEach(ObjectList, i, docs) { | ||
890 | iDocumentWidget *doc = i.object; | ||
891 | iMemInfo usage = memoryUsage_History(history_DocumentWidget(doc)); | ||
892 | total.cacheSize += usage.cacheSize; | ||
893 | total.memorySize += usage.memorySize; | ||
894 | } | ||
895 | appendFormat_String(msg, "Total cache: %.3f MB\n", total.cacheSize / 1.0e6f); | ||
896 | appendFormat_String(msg, "Total memory: %.3f MB\n", total.memorySize / 1.0e6f); | ||
897 | } | ||
886 | appendFormat_String(msg, "## Documents\n"); | 898 | appendFormat_String(msg, "## Documents\n"); |
887 | iForEach(ObjectList, k, iClob(listDocuments_App(NULL))) { | 899 | iForEach(ObjectList, k, docs) { |
888 | iDocumentWidget *doc = k.object; | 900 | iDocumentWidget *doc = k.object; |
889 | appendFormat_String(msg, "### Tab %d.%zu: %s\n", | 901 | appendFormat_String(msg, "### Tab %d.%zu: %s\n", |
890 | constAs_Widget(doc)->root == get_Window()->roots[0] ? 0 : 1, | 902 | constAs_Widget(doc)->root == get_Window()->roots[0] ? 1 : 2, |
891 | childIndex_Widget(constAs_Widget(doc)->parent, k.object), | 903 | childIndex_Widget(constAs_Widget(doc)->parent, k.object) + 1, |
892 | cstr_String(bookmarkTitle_DocumentWidget(doc))); | 904 | cstr_String(bookmarkTitle_DocumentWidget(doc))); |
893 | append_String(msg, collect_String(debugInfo_History(history_DocumentWidget(doc)))); | 905 | append_String(msg, collect_String(debugInfo_History(history_DocumentWidget(doc)))); |
894 | } | 906 | } |