perf_counter: perf_print_counter now works on QURT

This commit is contained in:
Julian Oes
2016-04-25 12:48:48 +02:00
committed by Lorenz Meier
parent d55b4802f1
commit 1cf7de8fdb
2 changed files with 8 additions and 10 deletions
+7 -9
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
* Copyright (C) 2012-2016 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,10 +46,8 @@
#include "perf_counter.h"
#ifdef __PX4_QURT
#define dprintf(...)
#define ddeclare(...)
#else
#define ddeclare(...) __VA_ARGS__
// There is presumably no dprintf on QURT. Therefore use the usual output to mini-dm.
#define dprintf(_fd, _text, ...) ((_fd) == 1 ? PX4_INFO((_text), ##__VA_ARGS__) : (void)(_fd))
#endif
/**
@@ -439,8 +437,8 @@ perf_print_counter_fd(int fd, perf_counter_t handle)
break;
case PC_ELAPSED: {
ddeclare(struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle;)
ddeclare(float rms = sqrtf(pce->M2 / (pce->event_count - 1));)
struct perf_ctr_elapsed *pce = (struct perf_ctr_elapsed *)handle;
float rms = sqrtf(pce->M2 / (pce->event_count - 1));
dprintf(fd, "%s: %llu events, %llu overruns, %lluus elapsed, %lluus avg, min %lluus max %lluus %5.3fus rms\n",
handle->name,
(unsigned long long)pce->event_count,
@@ -454,8 +452,8 @@ perf_print_counter_fd(int fd, perf_counter_t handle)
}
case PC_INTERVAL: {
ddeclare(struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle;)
ddeclare(float rms = sqrtf(pci->M2 / (pci->event_count - 1));)
struct perf_ctr_interval *pci = (struct perf_ctr_interval *)handle;
float rms = sqrtf(pci->M2 / (pci->event_count - 1));
dprintf(fd, "%s: %llu events, %lluus avg, min %lluus max %lluus %5.3fus rms\n",
handle->name,
+1 -1
View File
@@ -1,6 +1,6 @@
/****************************************************************************
*
* Copyright (C) 2012 PX4 Development Team. All rights reserved.
* Copyright (C) 2012-2016 PX4 Development Team. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions