diff options
author | Chunrong Guo <chunrong.guo@nxp.com> | 2017-07-28 15:44:09 +0800 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2017-08-07 11:42:29 -0300 |
commit | ece24e8f9a042561f188d8f09c60b146dd081c94 (patch) | |
tree | 1f9b832c30fa2740f16363187493814aca21a3c2 /recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch | |
parent | d586bfdde75ab6cae4f2dcdb63c068e07f4c188e (diff) | |
download | meta-freescale-ece24e8f9a042561f188d8f09c60b146dd081c94.tar.gz |
cryptodev-qoriq: update to v1.9
Signed-off-by: Chunrong Guo <B40290@freescale.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Diffstat (limited to 'recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch')
-rw-r--r-- | recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch | 173 |
1 files changed, 0 insertions, 173 deletions
diff --git a/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch b/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch deleted file mode 100644 index 4129010b..00000000 --- a/recipes-kernel/cryptodev/sdk_patches/0055-add-multithreaded-wrapper-for-async-speed-test.patch +++ /dev/null | |||
@@ -1,173 +0,0 @@ | |||
1 | From 789d3c5ecda60a6dc5d5b3597047ad65c412f10d Mon Sep 17 00:00:00 2001 | ||
2 | From: Cristian Stoica <cristian.stoica@nxp.com> | ||
3 | Date: Tue, 25 Oct 2016 15:30:59 +0300 | ||
4 | Subject: [PATCH 055/104] add multithreaded wrapper for async speed test | ||
5 | |||
6 | Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com> | ||
7 | --- | ||
8 | tests/Makefile | 1 + | ||
9 | tests/async_speed_multi.sh | 140 +++++++++++++++++++++++++++++++++++++++++++++ | ||
10 | 2 files changed, 141 insertions(+) | ||
11 | create mode 100755 tests/async_speed_multi.sh | ||
12 | |||
13 | diff --git a/tests/Makefile b/tests/Makefile | ||
14 | index 683f40b..6424c11 100644 | ||
15 | --- a/tests/Makefile | ||
16 | +++ b/tests/Makefile | ||
17 | @@ -40,6 +40,7 @@ install: | ||
18 | for prog in $(hostprogs); do \ | ||
19 | install -m 755 $$prog $(DESTDIR)/$(bindir)/tests_cryptodev/; \ | ||
20 | done | ||
21 | + install -m 755 async_speed_multi.sh $(DESTDIR)/$(bindir) | ||
22 | |||
23 | clean: | ||
24 | rm -f *.o *~ $(hostprogs) | ||
25 | diff --git a/tests/async_speed_multi.sh b/tests/async_speed_multi.sh | ||
26 | new file mode 100755 | ||
27 | index 0000000..761c0cb | ||
28 | --- /dev/null | ||
29 | +++ b/tests/async_speed_multi.sh | ||
30 | @@ -0,0 +1,140 @@ | ||
31 | +#!/bin/bash | ||
32 | +# | ||
33 | +# Copyright 2016 NXP Semiconductors | ||
34 | +# | ||
35 | +# This program is free software: you can redistribute it and/or modify | ||
36 | +# it under the terms of the GNU General Public License as published by | ||
37 | +# the Free Software Foundation, either version 2 of the License, or | ||
38 | +# (at your option) any later version. | ||
39 | +# | ||
40 | +# This program is distributed in the hope that it will be useful, | ||
41 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
42 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
43 | +# GNU General Public License for more details. | ||
44 | +# | ||
45 | +# You should have received a copy of the GNU General Public License | ||
46 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
47 | + | ||
48 | + | ||
49 | + | ||
50 | +# no user-configurable options below this line | ||
51 | + | ||
52 | +NUM_CORES=`nproc` | ||
53 | +OUT_BASENAME="async_speed" | ||
54 | +MPSTAT="mpstat" | ||
55 | +MPSTAT_OUT="mpstat_out" | ||
56 | + | ||
57 | +function usage | ||
58 | +{ | ||
59 | +cat << EOF | ||
60 | +Usage: `basename $0` [OPTIONS] <alg_name> | ||
61 | + | ||
62 | + -m <threads> number of threads to run with (defaults to number of cores) | ||
63 | + -t <secs> time to run each test (default 10 secs) | ||
64 | + -n <bytes> size of the test buffer (default 256 bytes) | ||
65 | + -h show this help | ||
66 | + | ||
67 | +alg_name: null, aes-128-cbc, aes-256-xts, sha1, sha256, crc32c | ||
68 | +EOF | ||
69 | +} | ||
70 | + | ||
71 | +function SUM { | ||
72 | + paste -sd+ - | bc -l | ||
73 | +} | ||
74 | + | ||
75 | +function get_cpu_idle | ||
76 | +{ | ||
77 | + header_line=`grep %idle ${MPSTAT_OUT} | head -n 1 | sed 's/\s\+/ /g'` | ||
78 | + idle_column=`echo $header_line | wc -w` | ||
79 | + | ||
80 | + all_cpu_idle=`grep all ${MPSTAT_OUT} | tail -n +2 | sed 's/\s\+/ /g' | cut -d' ' -f ${idle_column} | SUM` | ||
81 | + mpstat_lines=`grep all ${MPSTAT_OUT} | tail -n +2 | wc -l` | ||
82 | + | ||
83 | + average_idle=`echo "scale=2; $all_cpu_idle / $mpstat_lines" | bc -l` | ||
84 | + echo $average_idle | ||
85 | +} | ||
86 | + | ||
87 | +function run_parallel | ||
88 | +{ | ||
89 | + trap control_c SIGINT | ||
90 | + | ||
91 | + OPTIONS="-t $tvalue -n $nvalue -m" | ||
92 | + CMD="async_speed $OPTIONS $alg_name" | ||
93 | + | ||
94 | + echo "Running $mvalue threads in parallel:" | ||
95 | + echo " $CMD" | ||
96 | + | ||
97 | + $MPSTAT 1 $(($tvalue-1)) &> $MPSTAT_OUT & | ||
98 | + MPSTAT_PID=$! | ||
99 | + | ||
100 | + PIDS="" | ||
101 | + start=`date +%s.%N` | ||
102 | + | ||
103 | + for i in `seq 0 $(($mvalue-1))` | ||
104 | + do | ||
105 | + CMD_OUT="${OUT_BASENAME}_${i}" | ||
106 | + | ||
107 | + $CMD &> $CMD_OUT & | ||
108 | + PID=$! | ||
109 | + AFFINITY=$(($i % $NUM_CORES)) | ||
110 | + taskset -pc $AFFINITY $PID > /dev/null | ||
111 | + | ||
112 | + PIDS="$PID $PIDS" | ||
113 | + done | ||
114 | + | ||
115 | + wait $PIDS | ||
116 | + end=`date +%s.%N` | ||
117 | + | ||
118 | + wait $MPSTAT_PID | ||
119 | + | ||
120 | + runtime=$(echo "scale=2; $end - $start" | bc -l ) | ||
121 | + total_data=`cat ${OUT_BASENAME}_* | cut -f 1 | SUM` | ||
122 | + avg_speed=$(echo "scale=2; $total_data / $runtime / 1000000000" | bc -l) | ||
123 | + cpu_idle=`get_cpu_idle` | ||
124 | + | ||
125 | + echo | ||
126 | + echo "buffer size : $nvalue" | ||
127 | + echo "running time : $runtime" | ||
128 | + echo "avg_speed : $avg_speed GiB/s" | ||
129 | + echo "all_cpu idle : $cpu_idle %" | ||
130 | + echo | ||
131 | +} | ||
132 | + | ||
133 | +function control_c | ||
134 | +{ | ||
135 | + killall async_speed > /dev/null | ||
136 | + killall mpstat > /dev/null | ||
137 | +} | ||
138 | + | ||
139 | +function main | ||
140 | +{ | ||
141 | + while getopts hm:t:n: option | ||
142 | + do | ||
143 | + case "$option" in | ||
144 | + m) mvalue="$OPTARG";; | ||
145 | + t) tvalue="$OPTARG";; | ||
146 | + n) nvalue="$OPTARG";; | ||
147 | + *) usage $0; exit 1;; | ||
148 | + esac | ||
149 | + done | ||
150 | + | ||
151 | + shift $((OPTIND-1)) | ||
152 | + alg_name=$1 | ||
153 | + | ||
154 | + [ -z "$tvalue" ] && tvalue=10 # 10 seconds per test by default | ||
155 | + [ -z "$mvalue" ] && mvalue=`nproc` # thread count defaults to nproc | ||
156 | + [ -z "$nvalue" ] && nvalue=256 # 256 bytes default buffer size | ||
157 | + | ||
158 | + case "$alg_name" in | ||
159 | + "null" |\ | ||
160 | + "aes-128-cbc" |\ | ||
161 | + "aes-256-xts" |\ | ||
162 | + "sha1" |\ | ||
163 | + "sha256" |\ | ||
164 | + "crc32c" ) run_parallel;; | ||
165 | + * ) usage && exit 1;; | ||
166 | + esac | ||
167 | +} | ||
168 | + | ||
169 | +main "$@" | ||
170 | + | ||
171 | -- | ||
172 | 2.10.2 | ||
173 | |||