summaryrefslogtreecommitdiffstats
path: root/cpukit/libmisc/capture/captureimpl.h
diff options
context:
space:
mode:
authorChris Johns <chrisj@rtems.org>2016-08-30 16:46:25 +1000
committerChris Johns <chrisj@rtems.org>2016-09-01 11:11:22 +1000
commit6da06c559f17f33177f59c0f83164bb2d20c8b9f (patch)
tree9f4b23a8f6e5215489ffbb8219c85fd11aa08e6c /cpukit/libmisc/capture/captureimpl.h
parentarm/xilinx_zynq: Start the second core when an SMP build. (diff)
downloadrtems-6da06c559f17f33177f59c0f83164bb2d20c8b9f.tar.bz2
libmisc/capture: Fix the capture engine on SMP.
This patches some issues with the capture engine: 1. Check is the engine is open in ctrace commands. 2. Check all record open and appends for overflow. 3. Fix the record open to take the size of user data and not the record header. 4. Use packed structs for data being written to the per cpu buffers. 5. Remove direct struct access to the capture buffers to avoid misaligned accesses. 6. Add support to extract records, no struct access to the capture buffers. 7. Update ctrace to extract records from the capture buffers. 8. Add support to ctrace to always print the task name if it has one. 9. Add support to manage names or the lack of a name. 10. Range of minor fixes. 11. Fix a long standing bug in ctset's handling of args. Closes #2780.
Diffstat (limited to 'cpukit/libmisc/capture/captureimpl.h')
-rw-r--r--cpukit/libmisc/capture/captureimpl.h179
1 files changed, 13 insertions, 166 deletions
diff --git a/cpukit/libmisc/capture/captureimpl.h b/cpukit/libmisc/capture/captureimpl.h
index 753e41b5c5..78fd83ef34 100644
--- a/cpukit/libmisc/capture/captureimpl.h
+++ b/cpukit/libmisc/capture/captureimpl.h
@@ -10,9 +10,8 @@
/*
------------------------------------------------------------------------
- Copyright Objective Design Systems Pty Ltd, 2002
- All rights reserved Objective Design Systems Pty Ltd, 2002
- Chris Johns (ccj@acm.org)
+ Copyright 2002, 2016 Chris Johns <chrisj@rtems.org>.
+ All rights reserved.
COPYRIGHT (c) 1989-2014.
On-Line Applications Research Corporation (OAR).
@@ -32,31 +31,13 @@
#ifndef __CAPTUREIMPL_H_
#define __CAPTUREIMPL_H_
+#include "capture.h"
/**@{*/
#ifdef __cplusplus
extern "C" {
#endif
-#include "capture.h"
-
-/*
- * Global capture flags.
- */
-#define RTEMS_CAPTURE_INIT (1u << 0)
-#define RTEMS_CAPTURE_ON (1U << 1)
-#define RTEMS_CAPTURE_NO_MEMORY (1U << 2)
-#define RTEMS_CAPTURE_TRIGGERED (1U << 3)
-#define RTEMS_CAPTURE_GLOBAL_WATCH (1U << 4)
-#define RTEMS_CAPTURE_ONLY_MONITOR (1U << 5)
-
-/*
- * Per-CPU capture flags.
- */
-#define RTEMS_CAPTURE_OVERFLOW (1U << 0)
-#define RTEMS_CAPTURE_READER_ACTIVE (1U << 1)
-#define RTEMS_CAPTURE_READER_WAITING (1U << 2)
-
/**
* @brief Capture set extension index.
*
@@ -138,140 +119,6 @@ bool rtems_capture_trigger (rtems_tcb* ft,
uint32_t events);
/**
- * @brief Capture append to record
- *
- * This function Capture appends data to a capture record. It should
- * be called between rtems_capture_begin_add_record and
- * rtems_capture_end_add_record.
- *
- * @param[in] rec specifies the next location to write in the record
- * @param[in] data specifies the data to write
- * @param[in] size specifies specifies the size of the data
- *
- * @retval This method returns a pointer which is used as a marker
- * for the next location in the capture record. it should only be
- * used as input into rtems_capture_append_to_record or
- * rtems_capture_end_add_record.
- */
-static void *rtems_capture_append_to_record(void* rec,
- void* data,
- size_t size );
-
-/**
- * @brief Capture filter
- *
- * This function this function specifies if the given task
- * and events should be logged.
- *
- * @param[in] task specifies the capture task control block
- * @param[in] events specifies the events
- *
- * @retval This method returns true if this data should be
- * filtered from the log. It returns false if this data
- * should be logged.
- */
-bool rtems_capture_filter( rtems_tcb* task,
- uint32_t events);
-/**
- * @brief Capture begin add record.
- *
- * This function opens a record for writing and inserts
- * the header information
- *
- * @param[in] _task specifies the capture task block
- * @param[in] _events specifies the events
- * @param[in] _size specifies the expected size of the capture record
- * @param[out] _rec specifies the next write point in the capture record
- */
-#define rtems_capture_begin_add_record( _task, _events, _size, _rec) \
- do { \
- rtems_capture_record_context_t _context; \
- *_rec = rtems_capture_record_open( _task, _events, _size, &_context );
-
-/**
- * @brief Capture append to record.
- *
- * This function appends data of a specifed size into a capture record.
- *
- * @param[in] rec specifies the next write point in the capture record
- * @param[in] data specifies the data to write
- * @param[in] size specifies the size of the data
- *
- * @retval This method returns the next write point in the capture record.
- */
-static inline void *rtems_capture_append_to_record(void* rec,
- void* data,
- size_t size )
-{
- uint8_t *ptr = rec;
- memcpy( ptr, data, size );
- return (ptr + size);
-}
-
-/**
- * @brief Capture end add record.
- *
- * This function completes the add capture record process
- *
- * @param[in] _rec specifies the end of the capture record
- */
-#define rtems_capture_end_add_record( _rec ) \
- rtems_capture_record_close( _rec, &_context ); \
- } while (0)
-
-/**
- * @brief Capture returns the current time.
- *
- * This function returns the current time. If a handler is provided
- * by the user the time is gotten from that.
- *
- * @param[in] time specifies the capture time
- *
- * @retval This method returns a nano-second time if no user handler
- * is provided. Otherwise, it returns a resolution defined by the handler.
- */
-void rtems_capture_get_time (rtems_capture_time_t* time);
-
-typedef struct {
- rtems_interrupt_lock_context lock_context;
- rtems_interrupt_lock *lock;
-} rtems_capture_record_context_t;
-
-/**
- * @brief Capture record open.
- *
- * This function allocates a record and fills in the
- * header information. It does a lock acquire
- * which will remain in effect until
- * rtems_capture_record_close is called. This method
- * should only be used by rtems_capture_begin_add_record.
- *
- * @param[in] task specifies the caputre task block
- * @param[in] events specifies the events
- * @param[in] size specifies capture record size
- * @param[out] context specifies the record context
- *
- * @retval This method returns a pointer to the next location in
- * the capture record to store data.
- */
-void* rtems_capture_record_open (rtems_tcb* task,
- uint32_t events,
- size_t size,
- rtems_capture_record_context_t* context);
-/**
- * @brief Capture record close.
- *
- * This function closes writing to capure record and
- * releases the lock that was held on the record. This
- * method should only be used by rtems_capture_end_add_record.
- *
- * @param[in] rec specifies the record
- * @param[out] context specifies the record context
- */
-void rtems_capture_record_close( void *rec, rtems_capture_record_context_t* context);
-
-
-/**
* @brief Capture print trace records.
*
* This function reads, prints and releases up to
@@ -302,10 +149,9 @@ void rtems_capture_print_timestamp (uint64_t uptime);
* @param[in] cpu specifies the cpu the cpu the record was logged on.
* @param[in] rec specifies the task record.
*/
-void rtems_capture_print_record_task(
- uint32_t cpu,
- rtems_capture_record_t* rec
-);
+void rtems_capture_print_record_task(int cpu,
+ const rtems_capture_record_t* rec,
+ const rtems_capture_task_record_t* task_rec);
/**
* @brief Capture print capture record.
@@ -316,19 +162,20 @@ void rtems_capture_print_record_task(
* @param[in] cpu specifies the cpu the cpu the record was logged on.
* @param[in] rec specifies the record.
* @param[in] diff specifies the time between this and the last capture record.
+ * @param[in] name specifies the name of the task, NULL if none.
+ * @param[in] task_count number of tasks to search for.
*/
-void rtems_capture_print_record_capture(
- uint32_t cpu,
- rtems_capture_record_t* rec,
- uint64_t diff
-);
+void rtems_capture_print_record_capture(int cpu,
+ const rtems_capture_record_t* rec,
+ uint64_t diff,
+ const rtems_name* name);
/**
* @brief Capture print watch list
*
* This function prints a capture watch list
*/
-void rtems_capture_print_watch_list( void );
+void rtems_capture_print_watch_list (void);
#ifdef __cplusplus
}