Skip to content

Commit

Permalink
evl: latency instrumentation
Browse files Browse the repository at this point in the history
1) Tipical information screen in single run mode.

In this scenario, the DUT running linux was originally idle (hence the
high number of hits at ~30usec); then started executing hackbench [1]
to load the scheduler
[1] https://github.com/linux-test-project/ltp

* Example for time bounded test

=======================
Interrupt Latency tester
Max samples: 20000
=========================
Select test (default t)
*  : run until latency hit
~  : run for ever
t  : time bounded
: t

Max latency that will stop the test [usec, default 80] : 50
Enter period [default 5 msec]:
Enter calibrated latency [default 2500 nsec]:
 - test duration until latency hits 50000
 - period 5000 usec
 - calibrated latency 2500 ns

Test will capture 2000 samples
Press any key to begin
Histogram bin size in usec [min 1, default 5]:

Total number of samples: 1994
------- latency ----- -- nbr --  ---------------- chart ----------------------
 [0000000 - 0025791 ns]   0004     |
 [0025791 - 0030791 ns]   0896     -------------------------------------------------|
 [0030791 - 0035791 ns]   0019     -|
 [0035791 - 0040791 ns]   0001     |
 [0040791 - 0045791 ns]   0000
 [0045791 - 0050791 ns]   0008     |
 [0050791 - 0055791 ns]   0009     |
 [0055791 - 0060791 ns]   0016     |
 [0060791 - 0065791 ns]   0028     -|
 [0065791 - 0070791 ns]   0010     |
 [0070791 - 0075791 ns]   0009     |
 [0075791 - 0080791 ns]   0004     |
 [0080791 - 0085791 ns]   0007     |
 [0085791 - 0090791 ns]   0024     -|
 [0090791 - 0095791 ns]   0115     ------|
 [0095791 - 0100791 ns]   0320     -----------------|
 [0100791 - 0105791 ns]   0299     ----------------|
 [0105791 - 0110791 ns]   0134     -------|
 [0110791 - 0115791 ns]   0067     ---|
 [0115791 - 0120791 ns]   0014     |
 [0120791 - 0125791 ns]   0009     |
 [0125791 - 0126416 ns]   0001     |

Latency limits:
-------------------------
 min[0241] = 0025791 nsec at 1205 msec
 max[1248] = 0126416 nsec at 6240 msec
 test duration: 10000 msec

2) In continuous mode, the user can run

 * until a user programmable max latency is hit.
At that point the test stops and the histogram and sample history
is presented.

 *until the user-space code that responds to the Zephyr
device requests is halted (so the user needs to stop it).
At that point the histogram and the statistics are presented.

* Example of continuous mode:

=======================
Interrupt Latency tester
Max samples: 20000
=========================
Select test (default t)
*  : run until latency hit
~  : run for ever
t  : time bounded
: ~

Enter period [default 1 msec]:
Enter calibrated latency [default 1000 nsec]:
- test duration unbounded
 - period 1000 usec
 - calibrated latency 1000 ns
Press any key to begin
 max latency hit : 51708 nsec
 max latency hit : 57791 nsec
 max latency hit : 58541 nsec
 max latency hit : 59791 nsec
 max latency hit : 63166 nsec
 max latency hit : 63875 nsec
 max latency hit : 64541 nsec
 max latency hit : 66541 nsec
 max latency hit : 79375 nsec
 max latency hit : 89583 nsec

Latency test:
 nsamples    : 83577603
 max latency : 89583 nsec
 min latency : 16133 nsec
 overflows   : 0000
------- latency --------- -- nbr --  ---------------- chart ----------------------
 [0000000 - 0000000 ns]   0000
 [0000000 - 0010000 ns]   0000
 [0010000 - 0020000 ns]   1887557     -|
 [0020000 - 0030000 ns]   73650118     -------------------|
 [0030000 - 0040000 ns]   6475034     ----|
 [0040000 - 0050000 ns]   178122     |
 [0050000 - 0060000 ns]   3430     |
 [0060000 - 0070000 ns]   0066     |
 [0070000 - 0080000 ns]   0003     |
 [0080000 - 0090000 ns]   0001     |
 [0090000 - 0100000 ns]   0000
 [0100000 - 0110000 ns]   0000
 [0110000 - 0120000 ns]   0000
 [0120000 - 0130000 ns]   0000
 [0130000 - 0140000 ns]   0000
 [0140000 - 0150000 ns]   0000
 [0150000 - 0160000 ns]   0000
 [0160000 - 0170000 ns]   0000
 [0170000 - 0180000 ns]   0000
 [0180000 - 0190000 ns]   0000
 [0190000 -        max]   0000
  • Loading branch information
ldts committed Jul 1, 2019
1 parent e9ed634 commit 312fc19
Show file tree
Hide file tree
Showing 6 changed files with 584 additions and 0 deletions.
18 changes: 18 additions & 0 deletions boards/arm/frdm_k64f/frdm_k64f.dts
Expand Up @@ -36,6 +36,8 @@
sw0 = &user_button_3;
sw1 = &user_button_2;
eth = ð
tx = &transmit_gpio;
rx = &receive_gpio;
};

chosen {
Expand All @@ -49,30 +51,46 @@

leds {
compatible = "gpio-leds";

red_led: led_0 {
gpios = <&gpiob 22 0>;
label = "User LD1";
};

green_led: led_1 {
gpios = <&gpioe 26 0>;
label = "User LD2";
};

blue_led: led_2 {
gpios = <&gpiob 21 0>;
label = "User LD3";
};

transmit_gpio: transmit {
gpios = <&gpioe 24 0>;
label = "To DUT";
};
};

gpio_keys {
compatible = "gpio-keys";

user_button_2: button_0 {
label = "User SW2";
gpios = <&gpioc 6 GPIO_INT_ACTIVE_LOW>;
};

user_button_3: button_1 {
label = "User SW3";
gpios = <&gpioa 4 GPIO_INT_ACTIVE_LOW>;
};

receive_gpio: receive {
label = "From DUT";
gpios = <&gpioe 25 GPIO_INT_ACTIVE_HIGH>;
};

};
};

Expand Down
3 changes: 3 additions & 0 deletions boards/arm/frdm_k64f/pinmux.c
Expand Up @@ -108,6 +108,9 @@ static int frdm_k64f_pinmux_init(struct device *dev)
| PORT_PCR_ODE_MASK);
pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAlt5)
| PORT_PCR_ODE_MASK);
#else
pinmux_pin_set(porte, 24, PORT_PCR_MUX(kPORT_MuxAsGpio));
pinmux_pin_set(porte, 25, PORT_PCR_MUX(kPORT_MuxAsGpio));
#endif

#if CONFIG_ADC_1
Expand Down
8 changes: 8 additions & 0 deletions samples/drivers/gpio_latency/CMakeLists.txt
@@ -0,0 +1,8 @@
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.13.1)
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
project(gpio_latency)

FILE(GLOB app_sources src/*.c)
target_sources(app PRIVATE ${app_sources})
5 changes: 5 additions & 0 deletions samples/drivers/gpio_latency/prj.conf
@@ -0,0 +1,5 @@
CONFIG_LOG=y
CONFIG_GPIO=y
CONFIG_TICKLESS_KERNEL=y
CONFIG_CONSOLE_SUBSYS=y
CONFIG_CONSOLE_GETLINE=y
11 changes: 11 additions & 0 deletions samples/drivers/gpio_latency/sample.yaml
@@ -0,0 +1,11 @@
sample:
name: GPIO Latency instrumentation tool
tests:
sample.driver.gpio_latency:
tags: drivers
harness: console
harness_config:
type: one_line
regex:
- "Toggling (.*)"
depends_on: gpio

0 comments on commit 312fc19

Please sign in to comment.