bdev: make bdevs array for get_bdevs_iostat RPC
Fixes issue #775. Signed-off-by: Jim Harris <james.r.harris@intel.com> Change-Id: I5e07084599c2363b64619f38bd826fe100217020 Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/452477 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Seth Howell <seth.howell5141@gmail.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
e13da83e4a
commit
915270db68
@ -14,6 +14,12 @@ The function `spdk_notify_get_types()` and `spdk_notify_get_events()` were
|
||||
renamed to `spdk_notify_foreach_type()` and `spdk_notify_foreach_event()`,
|
||||
respectively. And update type name of callback accordingly.
|
||||
|
||||
### bdev
|
||||
|
||||
The format of the data returned by the get_bdevs_iostat RPC has changed to
|
||||
make it easier to parse. It now returns an object with a "ticks" object
|
||||
and "bdevs" array with the per-bdev statistics.
|
||||
|
||||
## v19.04:
|
||||
|
||||
### nvme
|
||||
|
@ -623,27 +623,27 @@ Example response:
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"id": 1,
|
||||
"result": [
|
||||
{
|
||||
"tick_rate": 2200000000
|
||||
},
|
||||
{
|
||||
"name": "Nvme0n1",
|
||||
"bytes_read": 36864,
|
||||
"num_read_ops": 2,
|
||||
"bytes_written": 0,
|
||||
"num_write_ops": 0,
|
||||
"bytes_unmapped": 0,
|
||||
"num_unmap_ops": 0,
|
||||
"read_latency_ticks": 178904,
|
||||
"write_latency_ticks": 0,
|
||||
"unmap_latency_ticks": 0,
|
||||
"queue_depth_polling_period": 2,
|
||||
"queue_depth": 0,
|
||||
"io_time": 0,
|
||||
"weighted_io_time": 0
|
||||
}
|
||||
]
|
||||
"result": {
|
||||
"tick_rate": 2200000000,
|
||||
"bdevs" : [
|
||||
{
|
||||
"name": "Nvme0n1",
|
||||
"bytes_read": 36864,
|
||||
"num_read_ops": 2,
|
||||
"bytes_written": 0,
|
||||
"num_write_ops": 0,
|
||||
"bytes_unmapped": 0,
|
||||
"num_unmap_ops": 0,
|
||||
"read_latency_ticks": 178904,
|
||||
"write_latency_ticks": 0,
|
||||
"unmap_latency_ticks": 0,
|
||||
"queue_depth_polling_period": 2,
|
||||
"queue_depth": 0,
|
||||
"io_time": 0,
|
||||
"weighted_io_time": 0
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
~~~
|
||||
|
||||
|
@ -102,6 +102,7 @@ done:
|
||||
free(stat);
|
||||
if (--ctx->bdev_count == 0) {
|
||||
spdk_json_write_array_end(ctx->w);
|
||||
spdk_json_write_object_end(w);
|
||||
spdk_jsonrpc_end_result(ctx->request, ctx->w);
|
||||
free(ctx);
|
||||
}
|
||||
@ -171,11 +172,11 @@ spdk_rpc_get_bdevs_iostat(struct spdk_jsonrpc_request *request,
|
||||
ctx->request = request;
|
||||
ctx->w = w;
|
||||
|
||||
spdk_json_write_array_begin(w);
|
||||
|
||||
spdk_json_write_object_begin(w);
|
||||
spdk_json_write_named_uint64(w, "tick_rate", spdk_get_ticks_hz());
|
||||
spdk_json_write_object_end(w);
|
||||
|
||||
spdk_json_write_named_array_begin(w, "bdevs");
|
||||
|
||||
if (bdev != NULL) {
|
||||
stat = calloc(1, sizeof(struct spdk_bdev_io_stat));
|
||||
@ -199,6 +200,7 @@ spdk_rpc_get_bdevs_iostat(struct spdk_jsonrpc_request *request,
|
||||
|
||||
if (--ctx->bdev_count == 0) {
|
||||
spdk_json_write_array_end(w);
|
||||
spdk_json_write_object_end(w);
|
||||
spdk_jsonrpc_end_result(request, w);
|
||||
free(ctx);
|
||||
}
|
||||
|
@ -20,17 +20,17 @@ function check_qos_works_well() {
|
||||
fi
|
||||
|
||||
if [ $LIMIT_TYPE = IOPS ]; then
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
|
||||
else
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
|
||||
start_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
|
||||
fi
|
||||
|
||||
$fio_py iscsi 1024 128 randread 5 1
|
||||
|
||||
if [ $LIMIT_TYPE = IOPS ]; then
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].num_read_ops')
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].num_read_ops')
|
||||
else
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.[1].bytes_read')
|
||||
end_io_count=$($rpc_py get_bdevs_iostat -b $3 | jq -r '.bdevs[0].bytes_read')
|
||||
fi
|
||||
|
||||
read_result=$(((end_io_count-start_io_count)/5))
|
||||
|
@ -35,7 +35,7 @@ function waitforio() {
|
||||
local ret=1
|
||||
local i
|
||||
for (( i = 10; i != 0; i-- )); do
|
||||
read_io_count=$($rpc_py -s $1 get_bdevs_iostat -b $2 | jq -r '.[1].num_read_ops')
|
||||
read_io_count=$($rpc_py -s $1 get_bdevs_iostat -b $2 | jq -r '.bdevs[0].num_read_ops')
|
||||
# A few I/O will happen during initial examine. So wait until at least 100 I/O
|
||||
# have completed to know that bdevperf is really generating the I/O.
|
||||
if [ $read_io_count -ge 100 ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user