RPC: rename get_bdev_histogram to bdev_get_histogram

Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com>
Change-Id: I2cc4d0a39d508e87608f4181ff8bf1b6bd12d839
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/468087
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Paul Luse <paul.e.luse@intel.com>
Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
Maciej Wawryk 2019-09-11 12:54:13 +02:00 committed by Ben Walker
parent ab6ce82806
commit 11f6b77370
6 changed files with 25 additions and 22 deletions

View File

@ -85,7 +85,7 @@ limit. Users can run this command with `-h` or `--help` for more information.
The `bdev_enable_histogram` RPC command allows to enable or disable gathering
latency data for specified bdev. Histogram can be downloaded by the user by
calling `get_bdev_histogram` and parsed using scripts/histogram.py script.
calling `bdev_get_histogram` and parsed using scripts/histogram.py script.
Example command
@ -93,7 +93,7 @@ Example command
The command will enable gathering data for histogram on Nvme0n1 device.
`rpc.py get_bdev_histogram Nvme0n1 | histogram.py`
`rpc.py bdev_get_histogram Nvme0n1 | histogram.py`
The command will download gathered histogram data. The script will parse
the data and show table containing IO count for latency ranges.

View File

@ -725,7 +725,7 @@ Example response:
}
~~~
## get_bdev_histogram {#rpc_get_bdev_histogram}
## bdev_get_histogram {#rpc_bdev_get_histogram}
Get latency histogram for specified bdev.
@ -751,7 +751,7 @@ Example request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "get_bdev_histogram",
"method": "bdev_get_histogram",
"params": {
"name": "Nvme0n1"
}

View File

@ -568,16 +568,16 @@ SPDK_RPC_REGISTER_ALIAS_DEPRECATED(bdev_enable_histogram, enable_bdev_histogram)
/* SPDK_RPC_GET_BDEV_HISTOGRAM */
struct rpc_get_bdev_histogram_request {
struct rpc_bdev_get_histogram_request {
char *name;
};
static const struct spdk_json_object_decoder rpc_get_bdev_histogram_request_decoders[] = {
{"name", offsetof(struct rpc_get_bdev_histogram_request, name), spdk_json_decode_string}
static const struct spdk_json_object_decoder rpc_bdev_get_histogram_request_decoders[] = {
{"name", offsetof(struct rpc_bdev_get_histogram_request, name), spdk_json_decode_string}
};
static void
free_rpc_get_bdev_histogram_request(struct rpc_get_bdev_histogram_request *r)
free_rpc_bdev_get_histogram_request(struct rpc_bdev_get_histogram_request *r)
{
free(r->name);
}
@ -630,15 +630,15 @@ invalid:
}
static void
spdk_rpc_get_bdev_histogram(struct spdk_jsonrpc_request *request,
spdk_rpc_bdev_get_histogram(struct spdk_jsonrpc_request *request,
const struct spdk_json_val *params)
{
struct rpc_get_bdev_histogram_request req = {NULL};
struct rpc_bdev_get_histogram_request req = {NULL};
struct spdk_histogram_data *histogram;
struct spdk_bdev *bdev;
if (spdk_json_decode_object(params, rpc_get_bdev_histogram_request_decoders,
SPDK_COUNTOF(rpc_get_bdev_histogram_request_decoders),
if (spdk_json_decode_object(params, rpc_bdev_get_histogram_request_decoders,
SPDK_COUNTOF(rpc_bdev_get_histogram_request_decoders),
&req)) {
SPDK_ERRLOG("spdk_json_decode_object failed\n");
spdk_jsonrpc_send_error_response(request, SPDK_JSONRPC_ERROR_INTERNAL_ERROR,
@ -661,7 +661,8 @@ spdk_rpc_get_bdev_histogram(struct spdk_jsonrpc_request *request,
spdk_bdev_histogram_get(bdev, histogram, _spdk_rpc_bdev_histogram_data_cb, request);
cleanup:
free_rpc_get_bdev_histogram_request(&req);
free_rpc_bdev_get_histogram_request(&req);
}
SPDK_RPC_REGISTER("get_bdev_histogram", spdk_rpc_get_bdev_histogram, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER("bdev_get_histogram", spdk_rpc_bdev_get_histogram, SPDK_RPC_RUNTIME)
SPDK_RPC_REGISTER_ALIAS_DEPRECATED(bdev_get_histogram, get_bdev_histogram)

View File

@ -598,12 +598,13 @@ if __name__ == "__main__":
p.add_argument('name', help='bdev name')
p.set_defaults(func=bdev_enable_histogram)
def get_bdev_histogram(args):
print_dict(rpc.bdev.get_bdev_histogram(args.client, name=args.name))
def bdev_get_histogram(args):
print_dict(rpc.bdev.bdev_get_histogram(args.client, name=args.name))
p = subparsers.add_parser('get_bdev_histogram', help='Get histogram for specified bdev')
p = subparsers.add_parser('bdev_get_histogram', aliases=['get_bdev_histogram'],
help='Get histogram for specified bdev')
p.add_argument('name', help='bdev name')
p.set_defaults(func=get_bdev_histogram)
p.set_defaults(func=bdev_get_histogram)
def bdev_set_qd_sampling_period(args):
rpc.bdev.bdev_set_qd_sampling_period(args.client,

View File

@ -746,14 +746,15 @@ def bdev_enable_histogram(client, name, enable):
return client.call('bdev_enable_histogram', params)
def get_bdev_histogram(client, name):
@deprecated_alias('get_bdev_histogram')
def bdev_get_histogram(client, name):
"""Get histogram for specified bdev.
Args:
bdev_name: name of bdev
"""
params = {'name': name}
return client.call('get_bdev_histogram', params)
return client.call('bdev_get_histogram', params)
@deprecated_alias('bdev_inject_error')

View File

@ -40,7 +40,7 @@ bdev_perf_pid=$!
waitforlisten $bdev_perf_pid
$rpc_py bdev_enable_histogram aio0 -e
sleep 2
$rpc_py get_bdev_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_get_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_enable_histogram aio0 -d
wait $bdev_perf_pid
@ -49,7 +49,7 @@ bdev_perf_pid=$!
waitforlisten $bdev_perf_pid
$rpc_py bdev_enable_histogram aio0 -e
sleep 2
$rpc_py get_bdev_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_get_histogram aio0 | $rootdir/scripts/histogram.py
$rpc_py bdev_enable_histogram aio0 -d
wait $bdev_perf_pid