commit 430d3bad7af4a90e13b1cc764661045e85475f09
parent 4e667bd048c813a410eea7e68a2b7c0c980330ee
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 3 Jun 2018 18:17:17 +0200
debug: add some code to time the performance of get_totsize()
Don't activate this by passing --enable-debug. Just remove the
relevant #ifdefs when you want to test the performance of changes
in the counting code.
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/nano.c b/src/nano.c
@@ -465,8 +465,15 @@ void ingraft_buffer(filestruct *somebuffer)
}
#endif
+#ifdef DEBUG
+#include <time.h>
+ clock_t start = clock();
+#endif
/* Add the number of characters in the copied text to the file size. */
openfile->totsize += get_totsize(openfile->fileage, openfile->filebot);
+#ifdef DEBUG
+ statusline(ALERT, "Took: %.2f", (double)(clock() - start) / CLOCKS_PER_SEC);
+#endif
/* If we pasted onto the first line of the edit window, the corresponding
* struct has been freed, so... point at the start of the copied text. */