Commit Graph

109 Commits

Author SHA1 Message Date
Joel Sherrill
4b7fbc7c44 cpukit/libmisc/capture: Manually change license to BSD-2
These files did not follow the standard format and needed to be
changed manually.

Updates #3053.
2022-03-22 11:34:23 -05:00
Joel Sherrill
1dc5ba2a45 cpukit/capture: Change license to BSD-2
Updates #3053.
2022-03-22 11:34:23 -05:00
Frank Kühndel
59d0e6aed1 capture: Fix unaligned pointer value warning
rtems_name is a four byte integer.
Giving an rtems_name as value instead of a pointer to ctrace_task_name_add()
fixes not only the compiler warning but it is also a bit more safe

For those who have asked for the warning:

../../../cpukit/libmisc/capture/capture_support.c:352:49: warning:
taking address of packed member of 'struct rtems_capture_task_record'
may result in an unaligned pointer value [-Waddress-of-packed-member]
  352 |         ctrace_task_name_add (rec_out->task_id, &task_rec.name);
      |                                                 ^~~~~~~~~~~~~~
2020-10-10 15:02:56 +02:00
Sebastian Huber
9f2a2075fc capture: Move default trace data
Provide the default trace data in a separate file to avoid issues on targets
with a small-data area.

Close #3883.
2020-09-20 17:32:10 +02:00
Sebastian Huber
f9219db2a9 rtems: Add rtems_scheduler_get_processor_maximum()
Add rtems_scheduler_get_processor_maximum() as a replacement for
rtems_get_processor_count(). The rtems_get_processor_count() is a bit
orphaned. Adopt it by the Scheduler Manager. The count is also
misleading, since the processor set may have gaps and the actual count
of online processors may be less than the value returned by
rtems_get_processor_count().

Update #3732.
2019-04-09 08:06:46 +02:00
Sebastian Huber
03c9f24061 rtems: Add rtems_scheduler_get_processor()
Add rtems_scheduler_get_processor() as a replacement for
rtems_get_current_processor(). The rtems_get_current_processor() is a
bit orphaned. Adopt it by the Scheduler Manager. This is in line with
the glibc sched_getcpu() function.

Deprecate rtems_get_current_processor().

Update #3731.
2019-04-09 08:06:46 +02:00
Sebastian Huber
feea03b625 Remove explicit file names from @file
This makes the @file documentation independent of the actual file name.

Update #3707.
2019-02-28 11:47:33 +01:00
Daniel Hellstrom
0d51b6d87e capture: prevent unaligned access when reading time
LLVM warns about this:
 cpukit/libmisc/capture/capture.c:405:30: warning:
      taking address of packed member 'time' of class or structure
      'rtems_capture_record' may result in an unaligned pointer value
      [-Waddress-of-packed-member]
    rtems_capture_get_time (&in.time);

And on sparc it generates an unaligned trap which makes smpcapture01
and smpcapture02 test to fail on sparc.
2018-08-24 15:51:39 +02:00
Chris Johns
2afb22b7e1 Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step.  It
copied header files from arbitrary locations into the build tree.  The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

* The make preinstall step itself needs time and disk space.

* Errors in header files show up in the build tree copy.  This makes it
  hard for editors to open the right file to fix the error.

* There is no clear relationship between source and build tree header
  files.  This makes an audit of the build process difficult.

* The visibility of all header files in the build tree makes it
  difficult to enforce API barriers.  For example it is discouraged to
  use BSP-specifics in the cpukit.

* An introduction of a new build system is difficult.

* Include paths specified by the -B option are system headers.  This
  may suppress warnings.

* The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step.   All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc.  Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

* cpukit/include

* cpukit/score/cpu/@RTEMS_CPU@/include

* cpukit/libnetworking

The new BSP include directories are:

* bsps/include

* bsps/@RTEMS_CPU@/include

* bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed.  The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.
2018-01-25 08:45:26 +01:00
Sebastian Huber
249730ded2 capture: Include <rtems/captureimpl.h>
Prepare for header file move to common include directory.

Update #3254.
2017-12-13 09:04:26 +01:00
Joel Sherrill
9761b98dcc capture/rtems-trace-buffer-vars.c: Fix duplicate const warning 2017-06-21 12:50:30 -05:00
Sebastian Huber
2dd098a635 score: Introduce Thread_Scheduler_control::home
Replace Thread_Scheduler_control::control and
Thread_Scheduler_control::own_control with new
Thread_Scheduler_control::home.

Update #2556.
2016-11-02 10:05:45 +01:00
Sebastian Huber
d271c3bb78 rtems: Add rtems_task_iterate()
Update #2423.
2016-11-02 08:46:47 +01:00
Sebastian Huber
300f6a481a score: Rework thread priority management
Add priority nodes which contribute to the overall thread priority.

The actual priority of a thread is now an aggregation of priority nodes.
The thread priority aggregation for the home scheduler instance of a
thread consists of at least one priority node, which is normally the
real priority of the thread.  The locking protocols (e.g. priority
ceiling and priority inheritance), rate-monotonic period objects and the
POSIX sporadic server add, change and remove priority nodes.

A thread changes its priority now immediately, e.g. priority changes are
not deferred until the thread releases its last resource.

Replace the _Thread_Change_priority() function with

 * _Thread_Priority_perform_actions(),
 * _Thread_Priority_add(),
 * _Thread_Priority_remove(),
 * _Thread_Priority_change(), and
 * _Thread_Priority_update().

Update #2412.
Update #2556.
2016-09-21 08:59:26 +02:00
Sebastian Huber
b20b736382 score: Introduce _Thread_Get_priority()
Avoid direct access to thread internal data fields.
2016-09-08 09:55:28 +02:00
Sebastian Huber
1dd8ffff9f capture: Use proper accessor functions 2016-09-06 10:52:19 +02:00
Sebastian Huber
7af6b58c5c capture: Workaround to avoid misaligned access
Move the 64-bit field to a not 64-bit aligned structure offset to stop
the compiler from generating 64-bit load/store operations.
2016-09-06 09:53:08 +02:00
Chris Johns
1c18ebf0d6 libmisc/capture: Remove the reserved _t in the types. 2016-09-01 11:11:45 +10:00
Chris Johns
6da06c559f 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.
2016-09-01 11:11:22 +10:00
Sebastian Huber
c82835a231 rtems: Rework RTEMS API to SuperCore priority
Use same structure as POSIX API for thread priority conversion to/from
SuperCore.
2016-06-22 14:00:28 +02:00
Sebastian Huber
df23f464be capture: Fix use of per-processor data
Get the current processor index only once and with interrupts disabled.

Close #2707.
2016-05-12 13:24:43 +02:00
Sebastian Huber
d449c12df3 capture: Remove superfluous includes 2016-05-12 13:24:43 +02:00
Sebastian Huber
7bd18697f8 capture: Compact rtems_capture_record_t
Order fields according to alignment to reduce structure internal
padding.
2016-05-12 13:24:42 +02:00
Sebastian Huber
2f11d4a014 capture: Fix buffer allocation and free
Do not use function static variables.  Remove superfluous volatile
qualifiers.  Use proper integer types.

Close #2706.
2016-05-12 13:24:42 +02:00
Sebastian Huber
f97536dcd3 basdefs.h: Add and use RTEMS_UNUSED 2015-10-26 09:13:19 +01:00
Sebastian Huber
504e042d86 capture: Define __rtld_tbg_lock 2015-04-02 08:28:12 +02:00
Chris Johns
a300920de1 libmisc/shell: Add the rtrace command for buffered tracing support.
The rtrace command interfaces to the RTEMS Trace Linker's trace
buffering data allowing users to capture and report trace data.
2015-03-31 17:04:43 +11:00
Joel Sherrill
735efe7e6d capture/capture_support.c: Fix printf() warning and formatting 2015-03-24 08:16:27 -05:00
Chris Johns
da30417b24 libmisc/capture: Clean up formatting on ARM.
The printing of 64bit diff's for the timestamp did not work on ARM
so I have changed this to 32bit. A 32bit nano-second diff between
events should be more than enough time.

Print '____' for POSIX thread output.
2015-03-19 18:25:51 +11:00
Gedare Bloom
ed152a0c4b capture: fix warnings in print 2015-03-16 12:49:47 -04:00
Joel Sherrill
bdf23b6cd4 cpukit: Remove old DESCRIPTION: in comments
These were remnants of pre-Doxygen comment style.
2015-03-11 16:18:29 -05:00
Joel Sherrill
cc69334f42 Fix a number of minor Doxygen formatting issues 2015-03-06 10:37:55 -06:00
Sebastian Huber
16b2de3545 capture: Fix warnings 2015-03-05 11:33:57 +01:00
Sebastian Huber
cfe6d05e3b capture: Fix lock initialization 2015-01-09 14:03:32 +01:00
Jennifer Averett
0a0ded702a capture: Resolve failure path memory leak. 2014-11-25 12:50:17 -06:00
Jennifer Averett
c577500023 capture: Remove whitespace and fix copyrights. 2014-11-24 14:04:54 -06:00
Jennifer Averett
66bf2af278 capture: Add SMP support.
To support smp data was broken into global and percpu capture data.
Capture control must be disabled prior to printing or setting of
watch points.
2014-11-24 14:04:54 -06:00
Jennifer Averett
04a13bdf74 capture: Move print methods out of cli for reuse.
Methods to print the data were moved from capture-cli into
a support area and are no longer static so that they can
be shared by test routines, or application code that wants
to use the capture engine without the shell interface.
2014-11-24 14:04:53 -06:00
Jennifer Averett
3d5bcdedfd capture: Move logging of task record to occur after filter check.
The catpture task record is now logged just prior to the first
log entry using that task instead of the first time the task
is seen.  This involved splitting the record task method into
an initialize task and a record task.
2014-11-24 14:04:53 -06:00
Jennifer Averett
8b11ff67a8 capture: Remove ctload command.
rtems_cpu_usage_top should be used for this information.
2014-10-28 07:58:28 -05:00
Jennifer Averett
05e4e59984 capture: Removal of capture task tracking.
This patch removes functionality for stack checking from
the capture engine and requiresi the use of existing rtems
functions for this information.  It modifies ctload to use
functionality similar to rtems cpuusage.  It removes the
capture task and stores a new capture task record the first
time the task is seen.  The per task data that was still
needed is scaled down and stored in the tcb.
2014-10-27 14:01:13 -05:00
Jennifer Averett
2a86615b98 capture: Add support for variable length records. 2014-09-05 06:50:29 -05:00
Jennifer Averett
133962bf2f capture: Split user extension methods out. 2014-09-05 06:50:29 -05:00
Jennifer Averett
463de590f0 capture: Fix capture engine to handle new extensions. 2014-07-11 09:48:50 -05:00
Jennifer Averett
1af8634a84 capture: Update comment block style in capture engine.
Doxygen added and comment blocks standardized.
2014-07-11 09:48:35 -05:00
Sebastian Huber
f39f667a69 score: Simplify _Thread_Change_priority()
The function to change a thread priority was too complex.  Simplify it
with a new scheduler operation.  This increases the average case
performance due to the simplified logic.  The interrupt disabled
critical section is a bit prolonged since now the extract, update and
enqueue steps are executed atomically.  This should however not impact
the worst-case interrupt latency since at least for the Deterministic
Priority Scheduler this sequence can be carried out with a wee bit of
instructions and no loops.

Add _Scheduler_Change_priority() to replace the sequence of
  - _Thread_Set_transient(),
  - _Scheduler_Extract(),
  - _Scheduler_Enqueue(), and
  - _Scheduler_Enqueue_first().

Delete STATES_TRANSIENT, _States_Is_transient() and
_Thread_Set_transient() since this state is now superfluous.

With this change it is possible to get rid of the
SCHEDULER_SMP_NODE_IN_THE_AIR state.  This considerably simplifies the
implementation of the new SMP locking protocols.
2014-05-15 12:18:44 +02:00
Sebastian Huber
2ca0a7be22 capture: Use ISR lock for SMP support 2014-04-14 08:37:04 +02:00
Chris Johns
6a26e9bbf5 cpukit/capture: Print the uptime and diff in ctrace.
Print the uptime and difference in nanoseconds to the previous
record in the ctrace output. For example:

    0:00:59.474927121     14760 0a01000c TNTD 235 235 CREATED_BY
    0:00:59.474927418       297 0a010012 /dev 235 235 CREATED
    0:00:59.474930799      3381 0a01000c TNTD 235 235 STARTED_BY
    0:00:59.474931105       306 0a010012 /dev 235 235 STARTED
    0:00:59.475072297    141192 0a01000c TNTD 235 235 SWITCHED_OUT
2013-12-24 18:08:29 +11:00
Chris Johns
9f9c0bbf47 cpukit/capture: Use the new RTEMS API to get the uptime in nanoseconds.
Use the new API to get the uptime in nanoseconds and update the capture
engine.
2013-12-24 16:46:19 +11:00
Daniel Ramirez
2bafb96037 rtems: classic api to/from core priority conversions 2013-12-21 20:09:02 -05:00