diff mbox series

[v2,bpf-next,2/2] bpftool: Documentation for bpftool prog profile

Message ID 20200228234058.634044-3-songliubraving@fb.com
State Changes Requested
Delegated to: BPF Maintainers
Headers show
Series bpftool: introduce prog profile | expand

Commit Message

Song Liu Feb. 28, 2020, 11:40 p.m. UTC
Add documentation for the new bpftool prog profile command.

Signed-off-by: Song Liu <songliubraving@fb.com>
---
 .../bpf/bpftool/Documentation/bpftool-prog.rst  | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Quentin Monnet March 2, 2020, 1:36 p.m. UTC | #1
2020-02-28 15:40 UTC-0800 ~ Song Liu <songliubraving@fb.com>
> Add documentation for the new bpftool prog profile command.
> 
> Signed-off-by: Song Liu <songliubraving@fb.com>
> ---
>  .../bpf/bpftool/Documentation/bpftool-prog.rst  | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> index 46862e85fed2..1e2549dcd926 100644
> --- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> +++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
> @@ -30,6 +30,7 @@ PROG COMMANDS
>  |	**bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
>  |	**bpftool** **prog tracelog**
>  |	**bpftool** **prog run** *PROG* **data_in** *FILE* [**data_out** *FILE* [**data_size_out** *L*]] [**ctx_in** *FILE* [**ctx_out** *FILE* [**ctx_size_out** *M*]]] [**repeat** *N*]
> +|	**bpftool** **prog profile** [*DURATION*] *PROG* *METRICs*
>  |	**bpftool** **prog help**
>  |
>  |	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
> @@ -48,6 +49,9 @@ PROG COMMANDS
>  |       *ATTACH_TYPE* := {
>  |		**msg_verdict** | **stream_verdict** | **stream_parser** | **flow_dissector**
>  |	}
> +|	*METRIC* := {
> +|		**cycles** | **instructions** | **l1d_loads** | **llc_misses**
> +|	}
>  
>  
>  DESCRIPTION
> @@ -189,6 +193,10 @@ DESCRIPTION
>  		  not all of them can take the **ctx_in**/**ctx_out**
>  		  arguments. bpftool does not perform checks on program types.
>  
> +	**bpftool prog profile** *DURATION* *PROG* *METRICs*

If I understand correctly DURATION is optional. Could you please add
square brackets around it? Could you please also specify what it
defaults to if user does not pass the value?

> +		  Profile *METRICs* for bpf program *PROG* for *DURATION*
> +		  seconds.
> +
>  	**bpftool prog help**
>  		  Print short help message.
>  
> @@ -311,6 +319,15 @@ EXAMPLES
>  
>  **# rm /sys/fs/bpf/xdp1**
>  
> +|
> +| **# bpftool prog profile 10 id 337 cycles instructions llc_misses**
> +
> +::
> +         51397 run_cnt
> +      40176203 cycles                                                 (83.05%)
> +      42518139 instructions    #   1.06 insn per cycle                (83.39%)
> +           123 llc_misses      #   2.89 LLC misses per million isns   (83.15%)
> +
>  SEE ALSO
>  ========
>  	**bpf**\ (2),
> 

Could you please also add bash completion for the new subcommand?

Thanks,
Quentin
diff mbox series

Patch

diff --git a/tools/bpf/bpftool/Documentation/bpftool-prog.rst b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
index 46862e85fed2..1e2549dcd926 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-prog.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-prog.rst
@@ -30,6 +30,7 @@  PROG COMMANDS
 |	**bpftool** **prog detach** *PROG* *ATTACH_TYPE* [*MAP*]
 |	**bpftool** **prog tracelog**
 |	**bpftool** **prog run** *PROG* **data_in** *FILE* [**data_out** *FILE* [**data_size_out** *L*]] [**ctx_in** *FILE* [**ctx_out** *FILE* [**ctx_size_out** *M*]]] [**repeat** *N*]
+|	**bpftool** **prog profile** [*DURATION*] *PROG* *METRICs*
 |	**bpftool** **prog help**
 |
 |	*MAP* := { **id** *MAP_ID* | **pinned** *FILE* }
@@ -48,6 +49,9 @@  PROG COMMANDS
 |       *ATTACH_TYPE* := {
 |		**msg_verdict** | **stream_verdict** | **stream_parser** | **flow_dissector**
 |	}
+|	*METRIC* := {
+|		**cycles** | **instructions** | **l1d_loads** | **llc_misses**
+|	}
 
 
 DESCRIPTION
@@ -189,6 +193,10 @@  DESCRIPTION
 		  not all of them can take the **ctx_in**/**ctx_out**
 		  arguments. bpftool does not perform checks on program types.
 
+	**bpftool prog profile** *DURATION* *PROG* *METRICs*
+		  Profile *METRICs* for bpf program *PROG* for *DURATION*
+		  seconds.
+
 	**bpftool prog help**
 		  Print short help message.
 
@@ -311,6 +319,15 @@  EXAMPLES
 
 **# rm /sys/fs/bpf/xdp1**
 
+|
+| **# bpftool prog profile 10 id 337 cycles instructions llc_misses**
+
+::
+         51397 run_cnt
+      40176203 cycles                                                 (83.05%)
+      42518139 instructions    #   1.06 insn per cycle                (83.39%)
+           123 llc_misses      #   2.89 LLC misses per million isns   (83.15%)
+
 SEE ALSO
 ========
 	**bpf**\ (2),