* [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes
@ 2021-10-05 15:00 Conor Walsh
2021-10-07 15:47 ` Power, Ciara
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Conor Walsh @ 2021-10-05 15:00 UTC (permalink / raw)
To: ciara.power, bruce.richardson; +Cc: dev, Conor Walsh
This patch adds the option --list (-l) to dpdk-telemetry.py which will
print all of the available dpdk file-prefixes that have telemetry enabled.
The prefixes will also be printed if the user passes an incorrect prefix
in the --file-prefix (-f) option.
Depends-on: series-19390 ("improve telemetry support with in-memory mode")
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
---
usertools/dpdk-telemetry.py | 40 +++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index 7f22e21828..b7a7553f52 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -72,6 +72,31 @@ def print_socket_options(prefix, paths):
s.split('.')[-1]))
+def get_dpdk_runtime_dir(fp):
+ """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
+ based on the file-prefix and user """
+ if (os.getuid() == 0):
+ return os.path.join('/var/run/dpdk', fp)
+ return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
+
+
+def list_fp():
+ """ List all available file-prefixes to user """
+ print("Valid file-prefixes:\n")
+ path = get_dpdk_runtime_dir('')
+
+ sockets = glob.glob(os.path.join(path, "*", SOCKET_NAME + "*"))
+ prefixes = []
+ if not sockets:
+ print("\tNo DPDK apps with telemetry enabled available")
+ for s in sockets:
+ prefixes.append(os.path.relpath(os.path.dirname(s), start=path))
+ for p in sorted(set(prefixes)):
+ print(p)
+ print_socket_options(p, glob.glob(os.path.join(path, p,
+ SOCKET_NAME + "*")))
+
+
def handle_socket(args, path):
""" Connect to socket and handle user input """
prompt = '' # this evaluates to false in conditions
@@ -95,6 +120,8 @@ def handle_socket(args, path):
if socks:
print("\nOther DPDK telemetry sockets found:")
print_socket_options(args.file_prefix, socks)
+ else:
+ list_fp()
return
json_reply = read_socket(sock, 1024, prompt)
output_buf_len = json_reply["max_output_len"]
@@ -130,14 +157,6 @@ def readline_complete(text, state):
return matches[state]
-def get_dpdk_runtime_dir(fp):
- """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
- based on the file-prefix and user """
- if (os.getuid() == 0):
- return os.path.join('/var/run/dpdk', fp)
- return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
-
-
readline.parse_and_bind('tab: complete')
readline.set_completer(readline_complete)
readline.set_completer_delims(readline.get_completer_delims().replace('/', ''))
@@ -145,9 +164,14 @@ def get_dpdk_runtime_dir(fp):
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--file-prefix', default=DEFAULT_PREFIX,
help='Provide file-prefix for DPDK runtime directory')
+parser.add_argument('-l', '--list', action="store_true", default=False,
+ help='List all possible file-prefixes and exit')
parser.add_argument('-p', '--pid',
help='Connect to DPDK process with the given pid')
args = parser.parse_args()
+if args.list:
+ list_fp()
+ sys.exit(0)
rd = get_dpdk_runtime_dir(args.file_prefix)
sock_path = os.path.join(rd, SOCKET_NAME)
if args.pid:
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes
2021-10-05 15:00 [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes Conor Walsh
@ 2021-10-07 15:47 ` Power, Ciara
2021-10-08 8:20 ` Walsh, Conor
2021-10-11 9:49 ` [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes Conor Walsh
2021-10-18 10:09 ` [dpdk-dev] [PATCH v3] " Conor Walsh
2 siblings, 1 reply; 9+ messages in thread
From: Power, Ciara @ 2021-10-07 15:47 UTC (permalink / raw)
To: Walsh, Conor, Richardson, Bruce; +Cc: dev
Hi Conor,
>-----Original Message-----
>From: Walsh, Conor <conor.walsh@intel.com>
>Sent: Tuesday 5 October 2021 16:00
>To: Power, Ciara <ciara.power@intel.com>; Richardson, Bruce
><bruce.richardson@intel.com>
>Cc: dev@dpdk.org; Walsh, Conor <conor.walsh@intel.com>
>Subject: [PATCH] usertools/telemetry: add listing of available file prefixes
>
>This patch adds the option --list (-l) to dpdk-telemetry.py which will print all of the
>available dpdk file-prefixes that have telemetry enabled.
>The prefixes will also be printed if the user passes an incorrect prefix in the --file-
>prefix (-f) option.
>
>Depends-on: series-19390 ("improve telemetry support with in-memory mode")
>
>Signed-off-by: Conor Walsh <conor.walsh@intel.com>
<snip>
>+
>+def list_fp():
>+ """ List all available file-prefixes to user """
>+ print("Valid file-prefixes:\n")
Nit: I think it might be cleaner to move this down to just before the file prefixes print out, so it doesn't print out when no apps are available.
>+ path = get_dpdk_runtime_dir('')
>+
>+ sockets = glob.glob(os.path.join(path, "*", SOCKET_NAME + "*"))
>+ prefixes = []
>+ if not sockets:
>+ print("\tNo DPDK apps with telemetry enabled available")
>+ for s in sockets:
>+ prefixes.append(os.path.relpath(os.path.dirname(s), start=path))
>+ for p in sorted(set(prefixes)):
>+ print(p)
>+ print_socket_options(p, glob.glob(os.path.join(path, p,
>+ SOCKET_NAME +
>+ "*")))
<snip>
Asides from that one small comment,
Acked-by: Ciara Power <ciara.power@intel.com>
Thanks!
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes
2021-10-07 15:47 ` Power, Ciara
@ 2021-10-08 8:20 ` Walsh, Conor
0 siblings, 0 replies; 9+ messages in thread
From: Walsh, Conor @ 2021-10-08 8:20 UTC (permalink / raw)
To: Power, Ciara, Richardson, Bruce; +Cc: dev
<snip>
>
> >+
> >+def list_fp():
> >+ """ List all available file-prefixes to user """
> >+ print("Valid file-prefixes:\n")
>
> Nit: I think it might be cleaner to move this down to just before the file
> prefixes print out, so it doesn't print out when no apps are available.
>
> >+ path = get_dpdk_runtime_dir('')
> >+
> >+ sockets = glob.glob(os.path.join(path, "*", SOCKET_NAME + "*"))
> >+ prefixes = []
> >+ if not sockets:
> >+ print("\tNo DPDK apps with telemetry enabled available")
> >+ for s in sockets:
> >+ prefixes.append(os.path.relpath(os.path.dirname(s), start=path))
> >+ for p in sorted(set(prefixes)):
> >+ print(p)
> >+ print_socket_options(p, glob.glob(os.path.join(path, p,
> >+ SOCKET_NAME +
> >+ "*")))
> <snip>
>
> Asides from that one small comment,
>
> Acked-by: Ciara Power <ciara.power@intel.com>
>
> Thanks!
Hi Ciara,
Thanks for the ack, I will address your comment in v2.
/Conor.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes
2021-10-05 15:00 [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes Conor Walsh
2021-10-07 15:47 ` Power, Ciara
@ 2021-10-11 9:49 ` Conor Walsh
2021-10-11 9:53 ` Walsh, Conor
2021-10-18 10:09 ` [dpdk-dev] [PATCH v3] " Conor Walsh
2 siblings, 1 reply; 9+ messages in thread
From: Conor Walsh @ 2021-10-11 9:49 UTC (permalink / raw)
To: ciara.power, bruce.richardson; +Cc: dev, Conor Walsh
This patch adds the option --list (-l) to dpdk-telemetry.py which will
print all of the available dpdk file-prefixes that have telemetry enabled.
The prefixes will also be printed if the user passes an incorrect prefix
in the --file-prefix (-f) option.
Depends-on: series-19464 ("improve telemetry support with in-memory mode")
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
---
usertools/dpdk-telemetry.py | 40 +++++++++++++++++++++++++++++--------
1 file changed, 32 insertions(+), 8 deletions(-)
diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index da3ba60430..d301511c7e 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -72,6 +72,31 @@ def print_socket_options(prefix, paths):
s.split(':')[-1]))
+def get_dpdk_runtime_dir(fp):
+ """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
+ based on the file-prefix and user """
+ if (os.getuid() == 0):
+ return os.path.join('/var/run/dpdk', fp)
+ return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
+
+
+def list_fp():
+ """ List all available file-prefixes to user """
+ path = get_dpdk_runtime_dir('')
+ sockets = glob.glob(os.path.join(path, "*", SOCKET_NAME + "*"))
+ prefixes = []
+ if not sockets:
+ print("No DPDK apps with telemetry enabled available")
+ else:
+ print("Valid file-prefixes:\n")
+ for s in sockets:
+ prefixes.append(os.path.relpath(os.path.dirname(s), start=path))
+ for p in sorted(set(prefixes)):
+ print(p)
+ print_socket_options(p, glob.glob(os.path.join(path, p,
+ SOCKET_NAME + "*")))
+
+
def handle_socket(args, path):
""" Connect to socket and handle user input """
prompt = '' # this evaluates to false in conditions
@@ -95,6 +120,8 @@ def handle_socket(args, path):
if socks:
print("\nOther DPDK telemetry sockets found:")
print_socket_options(args.file_prefix, socks)
+ else:
+ list_fp()
return
json_reply = read_socket(sock, 1024, prompt)
output_buf_len = json_reply["max_output_len"]
@@ -130,14 +157,6 @@ def readline_complete(text, state):
return matches[state]
-def get_dpdk_runtime_dir(fp):
- """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
- based on the file-prefix and user """
- if (os.getuid() == 0):
- return os.path.join('/var/run/dpdk', fp)
- return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
-
-
readline.parse_and_bind('tab: complete')
readline.set_completer(readline_complete)
readline.set_completer_delims(readline.get_completer_delims().replace('/', ''))
@@ -147,7 +166,12 @@ def get_dpdk_runtime_dir(fp):
help='Provide file-prefix for DPDK runtime directory')
parser.add_argument('-i', '--instance', default='0', type=int,
help='Provide file-prefix for DPDK runtime directory')
+parser.add_argument('-l', '--list', action="store_true", default=False,
+ help='List all possible file-prefixes and exit')
args = parser.parse_args()
+if args.list:
+ list_fp()
+ sys.exit(0)
sock_path = os.path.join(get_dpdk_runtime_dir(args.file_prefix), SOCKET_NAME)
if args.instance > 0:
sock_path += ":{}".format(args.instance)
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes
2021-10-11 9:49 ` [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes Conor Walsh
@ 2021-10-11 9:53 ` Walsh, Conor
2021-10-13 13:01 ` Walsh, Conor
0 siblings, 1 reply; 9+ messages in thread
From: Walsh, Conor @ 2021-10-11 9:53 UTC (permalink / raw)
To: Power, Ciara, Richardson, Bruce; +Cc: dev
<snip>
I forgot to include the changelog.
v2:
- Only print valid prefixes list header if telemetry available apps are available.
- Updated to v7 of the "improve telemetry support with in-memory mode" patchset.
Thanks,
Conor.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes
2021-10-11 9:53 ` Walsh, Conor
@ 2021-10-13 13:01 ` Walsh, Conor
2021-10-14 19:08 ` David Marchand
0 siblings, 1 reply; 9+ messages in thread
From: Walsh, Conor @ 2021-10-13 13:01 UTC (permalink / raw)
To: Power, Ciara, Richardson, Bruce; +Cc: dev
This patch is also compatible with the v8 of the "improve telemetry support with in-memory mode" patchset.
Thanks,
Conor.
> -----Original Message-----
> From: Walsh, Conor
> Sent: Monday 11 October 2021 10:54
> To: Power, Ciara <ciara.power@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>
> Cc: dev@dpdk.org
> Subject: RE: [PATCH v2] usertools/telemetry: add list of available file-prefixes
>
> <snip>
>
> I forgot to include the changelog.
>
> v2:
> - Only print valid prefixes list header if telemetry available apps are available.
> - Updated to v7 of the "improve telemetry support with in-memory mode"
> patchset.
>
> Thanks,
> Conor.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes
2021-10-13 13:01 ` Walsh, Conor
@ 2021-10-14 19:08 ` David Marchand
0 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2021-10-14 19:08 UTC (permalink / raw)
To: Walsh, Conor; +Cc: Power, Ciara, Richardson, Bruce, dev
On Wed, Oct 13, 2021 at 3:01 PM Walsh, Conor <conor.walsh@intel.com> wrote:
>
> This patch is also compatible with the v8 of the "improve telemetry support with in-memory mode" patchset.
Nice addition, can you add a description of this option in telemetry howto?
Thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 9+ messages in thread
* [dpdk-dev] [PATCH v3] usertools/telemetry: add list of available file-prefixes
2021-10-05 15:00 [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes Conor Walsh
2021-10-07 15:47 ` Power, Ciara
2021-10-11 9:49 ` [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes Conor Walsh
@ 2021-10-18 10:09 ` Conor Walsh
2021-10-19 13:34 ` David Marchand
2 siblings, 1 reply; 9+ messages in thread
From: Conor Walsh @ 2021-10-18 10:09 UTC (permalink / raw)
To: ciara.power, bruce.richardson, david.marchand; +Cc: dev, Conor Walsh
This patch adds the option --list (-l) to dpdk-telemetry.py which will
print all of the available dpdk file-prefixes that have telemetry enabled.
The prefixes will also be printed if the user passes an incorrect prefix
in the --file-prefix (-f) option.
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
---
v3:
- Add note to docs about list option.
- Remove dependancy notice.
v2:
- Only print valid prefixes list header if telemetry available apps
are available.
- Updated to v7 of the "improve telemetry support with in-memory mode"
patchset.
---
doc/guides/howto/telemetry.rst | 4 ++++
usertools/dpdk-telemetry.py | 40 +++++++++++++++++++++++++++-------
2 files changed, 36 insertions(+), 8 deletions(-)
diff --git a/doc/guides/howto/telemetry.rst b/doc/guides/howto/telemetry.rst
index b37dc0aab6..0464c431fe 100644
--- a/doc/guides/howto/telemetry.rst
+++ b/doc/guides/howto/telemetry.rst
@@ -109,6 +109,10 @@ instances are run:
$ ./usertools/dpdk-telemetry -f "tpmd"
+ To list all running telemetry-enabled file-prefixes, the ``-l`` or ``--list`` flags can be used::
+
+ $ ./usertools/dpdk-telemetry -l
+
* For the case where multiple processes are run using the `--in-memory` EAL flag,
but no `--file-prefix` flag, or the same `--file-prefix` flag,
those processes will all share the same runtime directory.
diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index 8f7d59d139..4d9f2d9787 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -72,6 +72,31 @@ def print_socket_options(prefix, paths):
s.split(':')[-1]))
+def get_dpdk_runtime_dir(fp):
+ """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
+ based on the file-prefix and user """
+ if (os.getuid() == 0):
+ return os.path.join('/var/run/dpdk', fp)
+ return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
+
+
+def list_fp():
+ """ List all available file-prefixes to user """
+ path = get_dpdk_runtime_dir('')
+ sockets = glob.glob(os.path.join(path, "*", SOCKET_NAME + "*"))
+ prefixes = []
+ if not sockets:
+ print("No DPDK apps with telemetry enabled available")
+ else:
+ print("Valid file-prefixes:\n")
+ for s in sockets:
+ prefixes.append(os.path.relpath(os.path.dirname(s), start=path))
+ for p in sorted(set(prefixes)):
+ print(p)
+ print_socket_options(p, glob.glob(os.path.join(path, p,
+ SOCKET_NAME + "*")))
+
+
def handle_socket(args, path):
""" Connect to socket and handle user input """
prompt = '' # this evaluates to false in conditions
@@ -95,6 +120,8 @@ def handle_socket(args, path):
if socks:
print("\nOther DPDK telemetry sockets found:")
print_socket_options(args.file_prefix, socks)
+ else:
+ list_fp()
return
json_reply = read_socket(sock, 1024, prompt)
output_buf_len = json_reply["max_output_len"]
@@ -130,14 +157,6 @@ def readline_complete(text, state):
return matches[state]
-def get_dpdk_runtime_dir(fp):
- """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory
- based on the file-prefix and user """
- if (os.getuid() == 0):
- return os.path.join('/var/run/dpdk', fp)
- return os.path.join(os.environ.get('XDG_RUNTIME_DIR', '/tmp'), 'dpdk', fp)
-
-
readline.parse_and_bind('tab: complete')
readline.set_completer(readline_complete)
readline.set_completer_delims(readline.get_completer_delims().replace('/', ''))
@@ -147,7 +166,12 @@ def get_dpdk_runtime_dir(fp):
help='Provide file-prefix for DPDK runtime directory')
parser.add_argument('-i', '--instance', default='0', type=int,
help='Provide file-prefix for DPDK runtime directory')
+parser.add_argument('-l', '--list', action="store_true", default=False,
+ help='List all possible file-prefixes and exit')
args = parser.parse_args()
+if args.list:
+ list_fp()
+ sys.exit(0)
sock_path = os.path.join(get_dpdk_runtime_dir(args.file_prefix), SOCKET_NAME)
if args.instance > 0:
sock_path += ":{}".format(args.instance)
--
2.25.1
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [dpdk-dev] [PATCH v3] usertools/telemetry: add list of available file-prefixes
2021-10-18 10:09 ` [dpdk-dev] [PATCH v3] " Conor Walsh
@ 2021-10-19 13:34 ` David Marchand
0 siblings, 0 replies; 9+ messages in thread
From: David Marchand @ 2021-10-19 13:34 UTC (permalink / raw)
To: Conor Walsh; +Cc: Ciara Power, Bruce Richardson, dev
On Mon, Oct 18, 2021 at 12:10 PM Conor Walsh <conor.walsh@intel.com> wrote:
>
> This patch adds the option --list (-l) to dpdk-telemetry.py which will
> print all of the available dpdk file-prefixes that have telemetry enabled.
> The prefixes will also be printed if the user passes an incorrect prefix
> in the --file-prefix (-f) option.
>
> Signed-off-by: Conor Walsh <conor.walsh@intel.com>
> Acked-by: Ciara Power <ciara.power@intel.com>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2021-10-19 13:35 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-05 15:00 [dpdk-dev] [PATCH] usertools/telemetry: add listing of available file prefixes Conor Walsh
2021-10-07 15:47 ` Power, Ciara
2021-10-08 8:20 ` Walsh, Conor
2021-10-11 9:49 ` [dpdk-dev] [PATCH v2] usertools/telemetry: add list of available file-prefixes Conor Walsh
2021-10-11 9:53 ` Walsh, Conor
2021-10-13 13:01 ` Walsh, Conor
2021-10-14 19:08 ` David Marchand
2021-10-18 10:09 ` [dpdk-dev] [PATCH v3] " Conor Walsh
2021-10-19 13:34 ` David Marchand
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).