summaryrefslogtreecommitdiffstats
path: root/spec/rtems/task/req/perf-set-scheduler-preempt.yml
blob: 0e6e62d1dfc327cd5b6011935484b10e3000f65c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
SPDX-License-Identifier: CC-BY-SA-4.0 OR BSD-2-Clause
copyrights:
- Copyright (C) 2021 embedded brains GmbH & Co. KG
enabled-by: RTEMS_SMP
links:
- role: requirement-refinement
  uid: perf-runtime
- role: runtime-measurement-request
  uid: ../val/perf
non-functional-type: performance-runtime
params: {}
rationale: null
references: []
requirement-type: non-functional
test-body:
  brief: |
    Move the worker to scheduler A.
  code: |
    ctx->begin = T_tick();
    ctx->status = rtems_task_set_scheduler(
      ctx->worker_id,
      SCHEDULER_A_ID,
      PRIO_HIGH
    );
  description: null
test-cleanup:
  brief: |
    Delete the worker tasks.
  code: |
    ResumeTask( ctx->worker_2_id );
    DeleteTask( ctx->worker_2_id );
    DeleteTask( ctx->worker_id );
  description: null
test-prepare:
  brief: |
    Create and start two worker tasks for scheduler B.  Make the second worker
    busy.
  code: |
    ctx->worker_id = CreateTask( "WORK", PRIO_NORMAL );
    SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
    StartTask( ctx->worker_id, Worker, ctx );
    Send( ctx, EVENT_SET_END );
    WaitForNextTask( 1, ctx->worker_id );

    ctx->worker_2_id = CreateTask( "WRK2", PRIO_NORMAL );
    SetScheduler( ctx->worker_2_id, SCHEDULER_B_ID, PRIO_HIGH );
    StartTask( ctx->worker_2_id, Worker, ctx );
    SendEvents( ctx->worker_2_id, EVENT_BUSY );
    SuspendTask( ctx->worker_2_id );
  description: null
test-setup:
  brief: |
    Move the worker to scheduler B.  Make the worker ready to set the end time.
  code: |
    ResumeTask( ctx->worker_2_id );
    SetScheduler( ctx->worker_id, SCHEDULER_B_ID, PRIO_NORMAL );
    Send( ctx, EVENT_SET_END );
  description: null
test-teardown:
  brief: |
    Set the measured runtime.  Discard samples interrupted by a clock tick.
  code: |
    T_quiet_rsc_success( ctx->status );

    *delta = ctx->end - ctx->begin;
    SuspendTask( ctx->worker_2_id );

    return tic == toc;
  description: null
text: |
  Let U and V be two tasks with the distinct home schedulers.  Let
  :math:`B` be a time point measured by U right before a call to
  ${../if/set-scheduler:/name} which moves task V to the home scheduler of
  U which preempts the caller.  Let :math:`E` be a time point measured by
  V right after the first context switch after :math:`B`.

  While the execution environment is ${.:/environment}, while the measurement
  sample is :math:`E - B`, when exactly ${../val/perf:/params/sample-count}
  samples are collected, the ${.:/limit-kind} shall be ${.:/limit-condition}.
type: requirement