mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-06 12:08:52 +08:00
perf_counter: perf_print_counter now works on QURT
This commit is contained in:
@@ -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,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
|
||||
|
||||
Reference in New Issue
Block a user