mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-02 03:49:12 +08:00
platforms: consolidate latency_buckets
These symbols were duplicated all over the place.
This commit is contained in:
@@ -39,6 +39,7 @@
|
|||||||
|
|
||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
#include <px4_workqueue.h>
|
#include <px4_workqueue.h>
|
||||||
|
#include <perf_counter.h>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
#include <semaphore.h>
|
#include <semaphore.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
@@ -49,12 +50,6 @@
|
|||||||
|
|
||||||
static struct sq_queue_s callout_queue;
|
static struct sq_queue_s callout_queue;
|
||||||
|
|
||||||
/* latency histogram */
|
|
||||||
#define LATENCY_BUCKET_COUNT 8
|
|
||||||
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
|
||||||
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
|
||||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
|
||||||
|
|
||||||
static void hrt_call_reschedule(void);
|
static void hrt_call_reschedule(void);
|
||||||
|
|
||||||
// Intervals in ms
|
// Intervals in ms
|
||||||
|
|||||||
@@ -178,13 +178,6 @@ static uint16_t latency_baseline;
|
|||||||
/* timer count at interrupt (for latency purposes) */
|
/* timer count at interrupt (for latency purposes) */
|
||||||
static uint16_t latency_actual;
|
static uint16_t latency_actual;
|
||||||
|
|
||||||
/* latency histogram */
|
|
||||||
#define LATENCY_BUCKET_COUNT 8
|
|
||||||
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
|
||||||
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
|
||||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
|
||||||
|
|
||||||
|
|
||||||
/* timer-specific functions */
|
/* timer-specific functions */
|
||||||
static void hrt_tim_init(void);
|
static void hrt_tim_init(void);
|
||||||
static int hrt_tim_isr(int irq, void *context, void *args);
|
static int hrt_tim_isr(int irq, void *context, void *args);
|
||||||
|
|||||||
@@ -192,13 +192,6 @@ static uint16_t latency_baseline;
|
|||||||
/* timer count at interrupt (for latency purposes) */
|
/* timer count at interrupt (for latency purposes) */
|
||||||
static uint16_t latency_actual;
|
static uint16_t latency_actual;
|
||||||
|
|
||||||
/* latency histogram */
|
|
||||||
#define LATENCY_BUCKET_COUNT 8
|
|
||||||
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
|
||||||
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
|
||||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
|
||||||
|
|
||||||
|
|
||||||
/* timer-specific functions */
|
/* timer-specific functions */
|
||||||
static void hrt_tim_init(void);
|
static void hrt_tim_init(void);
|
||||||
static void hrt_tim_isr(TC_HANDLE tch, void *arg, uint32_t sr);
|
static void hrt_tim_isr(TC_HANDLE tch, void *arg, uint32_t sr);
|
||||||
|
|||||||
@@ -61,6 +61,7 @@
|
|||||||
|
|
||||||
#include <board_config.h>
|
#include <board_config.h>
|
||||||
#include <drivers/drv_hrt.h>
|
#include <drivers/drv_hrt.h>
|
||||||
|
#include <lib/perf/perf_counter.h>
|
||||||
|
|
||||||
|
|
||||||
#include "stm32_gpio.h"
|
#include "stm32_gpio.h"
|
||||||
@@ -255,13 +256,6 @@ static uint16_t latency_baseline;
|
|||||||
/* timer count at interrupt (for latency purposes) */
|
/* timer count at interrupt (for latency purposes) */
|
||||||
static uint16_t latency_actual;
|
static uint16_t latency_actual;
|
||||||
|
|
||||||
/* latency histogram */
|
|
||||||
#define LATENCY_BUCKET_COUNT 8
|
|
||||||
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
|
||||||
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
|
||||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
|
||||||
|
|
||||||
|
|
||||||
/* timer-specific functions */
|
/* timer-specific functions */
|
||||||
static void hrt_tim_init(void);
|
static void hrt_tim_init(void);
|
||||||
static int hrt_tim_isr(int irq, void *context, void *arg);
|
static int hrt_tim_isr(int irq, void *context, void *arg);
|
||||||
|
|||||||
@@ -48,6 +48,11 @@
|
|||||||
|
|
||||||
#include "perf_counter.h"
|
#include "perf_counter.h"
|
||||||
|
|
||||||
|
/* latency histogram */
|
||||||
|
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
||||||
|
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
||||||
|
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
||||||
|
|
||||||
|
|
||||||
#ifdef __PX4_QURT
|
#ifdef __PX4_QURT
|
||||||
// There is presumably no dprintf on QURT. Therefore use the usual output to mini-dm.
|
// There is presumably no dprintf on QURT. Therefore use the usual output to mini-dm.
|
||||||
@@ -597,11 +602,6 @@ perf_print_all(int fd)
|
|||||||
pthread_mutex_unlock(&perf_counters_mutex);
|
pthread_mutex_unlock(&perf_counters_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
// these are defined in drv_hrt.c
|
|
||||||
extern const uint16_t latency_bucket_count;
|
|
||||||
extern uint32_t latency_counters[];
|
|
||||||
extern const uint16_t latency_buckets[];
|
|
||||||
|
|
||||||
void
|
void
|
||||||
perf_print_latency(int fd)
|
perf_print_latency(int fd)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -42,6 +42,12 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <px4_defines.h>
|
#include <px4_defines.h>
|
||||||
|
|
||||||
|
#define LATENCY_BUCKET_COUNT 8
|
||||||
|
|
||||||
|
extern const uint16_t latency_bucket_count;
|
||||||
|
extern const uint16_t latency_buckets[LATENCY_BUCKET_COUNT];
|
||||||
|
extern uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Counter types.
|
* Counter types.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -44,13 +44,6 @@
|
|||||||
__EXPORT int perf_main(int argc, char *argv[]);
|
__EXPORT int perf_main(int argc, char *argv[]);
|
||||||
|
|
||||||
|
|
||||||
/* latency histogram */
|
|
||||||
#define LATENCY_BUCKET_COUNT 8
|
|
||||||
__EXPORT const uint16_t latency_bucket_count = LATENCY_BUCKET_COUNT;
|
|
||||||
__EXPORT const uint16_t latency_buckets[LATENCY_BUCKET_COUNT] = { 1, 2, 5, 10, 20, 50, 100, 1000 };
|
|
||||||
__EXPORT uint32_t latency_counters[LATENCY_BUCKET_COUNT + 1];
|
|
||||||
|
|
||||||
|
|
||||||
static void print_usage(void)
|
static void print_usage(void)
|
||||||
{
|
{
|
||||||
PRINT_MODULE_DESCRIPTION("Tool to print performance counters");
|
PRINT_MODULE_DESCRIPTION("Tool to print performance counters");
|
||||||
|
|||||||
Reference in New Issue
Block a user