aboutsummaryrefslogtreecommitdiff
path: root/Debug/PX4
diff options
context:
space:
mode:
authorpx4dev <px4@purgatory.org>2013-01-14 09:34:33 -0800
committerpx4dev <px4@purgatory.org>2013-01-14 09:34:33 -0800
commit09535fef83918eff9ff7a8e77ad5a1aea6bf3c82 (patch)
treeaebad8aef0343346c28d212c0b6aea1b5b6b389b /Debug/PX4
parent9faf348cf5948c508a4a9b85e2ce5f6e51d48a2f (diff)
downloadpx4-firmware-09535fef83918eff9ff7a8e77ad5a1aea6bf3c82.tar.gz
px4-firmware-09535fef83918eff9ff7a8e77ad5a1aea6bf3c82.tar.bz2
px4-firmware-09535fef83918eff9ff7a8e77ad5a1aea6bf3c82.zip
Start adding PX4 firmware helper macros
Diffstat (limited to 'Debug/PX4')
-rw-r--r--Debug/PX454
1 files changed, 54 insertions, 0 deletions
diff --git a/Debug/PX4 b/Debug/PX4
new file mode 100644
index 000000000..7d5905939
--- /dev/null
+++ b/Debug/PX4
@@ -0,0 +1,54 @@
+#
+# Various PX4-specific macros
+#
+source Debug/NuttX
+
+echo Loading PX4 GDB macros. Use 'help px4' for more information.\n
+
+define px4
+ echo Use 'help px4' for more information.\n
+end
+
+document px4
+. Various macros for working with the PX4 firmware.
+.
+. perf
+. Prints the state of all performance counters.
+.
+. Use 'help <macro>' for more specific help.
+end
+
+
+define _perf_print
+ set $hdr = (struct perf_ctr_header *)$arg0
+ printf "%p\n", $hdr
+ printf "%s: ", $hdr->name
+ # PC_COUNT
+ if $hdr->type == 0
+ set $count = (struct perf_ctr_count *)$hdr
+ printf "%llu events,\n", $count->event_count;
+ end
+ # PC_ELPASED
+ if $hdr->type == 1
+ set $elapsed = (struct perf_ctr_elapsed *)$hdr
+ printf "%llu events, %lluus elapsed, min %lluus, max %lluus\n", $elapsed->event_count, $elapsed->time_total, $elapsed->time_least, $elapsed->time_most
+ end
+ # PC_INTERVAL
+ if $hdr->type == 2
+ set $interval = (struct perf_ctr_interval *)$hdr
+ printf "%llu events, %llu avg, min %lluus max %lluus\n", $interval->event_count, ($interval->time_last - $interval->time_first) / $interval->event_count, $interval->time_least, $interval->time_most
+ end
+end
+
+define perf
+ set $ctr = (sq_entry_t *)(perf_counters.head)
+ while $ctr != 0
+ _perf_print $ctr
+ set $ctr = $ctr->flink
+ end
+end
+
+document perf
+. perf
+. Prints performance counters.
+end