summaryrefslogtreecommitdiffstats
path: root/firmware/profile.c
diff options
context:
space:
mode:
authorBertrik Sikken <bertrik@sikken.nl>2008-04-28 18:41:13 +0000
committerBertrik Sikken <bertrik@sikken.nl>2008-04-28 18:41:13 +0000
commitcbd7fa40f6ba6d7c484299cbab06795196479ab4 (patch)
tree23f20b89506f66eaee66c8d7022f8a8c827fb0b3 /firmware/profile.c
parentbff3ddd5377e8b91e966fd4d3e19239053c1f168 (diff)
downloadrockbox-cbd7fa40f6ba6d7c484299cbab06795196479ab4.tar.gz
rockbox-cbd7fa40f6ba6d7c484299cbab06795196479ab4.tar.bz2
rockbox-cbd7fa40f6ba6d7c484299cbab06795196479ab4.zip
Moved private types and constants from profile.h to profile.c
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17284 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/profile.c')
-rw-r--r--firmware/profile.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/firmware/profile.c b/firmware/profile.c
index 71fe343879..0f445f42de 100644
--- a/firmware/profile.c
+++ b/firmware/profile.c
@@ -57,8 +57,41 @@
#include <system.h>
#include <string.h>
#include <timer.h>
+#include <sys/types.h>
#include "profile.h"
+
+/* PFD is Profiled Function Data */
+
+/* Indices are shorts which means that we use 4k of RAM */
+#define INDEX_BITS 11 /* What is a reasonable size for this? */
+#define INDEX_SIZE 2048 /* 2 ^ INDEX_BITS */
+#define INDEX_MASK 0x7FF /* lower INDEX_BITS 1 */
+
+/*
+ * In the current setup (pfd has 4 longs and 2 shorts) this uses 20k of RAM
+ * for profiling, and allows for profiling sections of code with up-to
+ * 1024 function caller->callee pairs
+ */
+#define NUMPFDS 1024
+
+struct pfd_struct {
+ void *self_pc;
+ unsigned long count;
+ unsigned long time;
+ unsigned short link;
+ struct pfd_struct *caller;
+};
+
+/* Possible states of profiling */
+#define PROF_ON 0x00
+#define PROF_BUSY 0x01
+#define PROF_ERROR 0x02
+#define PROF_OFF 0x03
+/* Masks for thread switches */
+#define PROF_OFF_THREAD 0x10
+#define PROF_ON_THREAD 0x0F
+
static unsigned short profiling = PROF_OFF;
static size_t recursion_level;
static unsigned short indices[INDEX_SIZE];