Re: [PATCH v4 bpf-next 1/4] bpftool: introduce "prog profile" command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Mar 04, 2020 at 10:07:07AM -0800, Song Liu wrote:

SNIP

> +
> +#include "profiler.skel.h"
> +
> +#define SAMPLE_PERIOD  0x7fffffffffffffffULL
> +struct profile_metric {
> +	const char *name;
> +	struct bpf_perf_event_value val;
> +	struct perf_event_attr attr;
> +	bool selected;
> +
> +	/* calculate ratios like instructions per cycle */
> +	const int ratio_metric; /* 0 for N/A, 1 for index 0 (cycles) */
> +	const char *ratio_desc;
> +	const float ratio_mul;
> +} metrics[] = {
> +	{
> +		.name = "cycles",
> +		.attr = {
> +			.sample_period = SAMPLE_PERIOD,

I don't think you need to set sample_period for counting.. why?

> +			.type = PERF_TYPE_HARDWARE,
> +			.config = PERF_COUNT_HW_CPU_CYCLES,

you could also add .exclude_user = 1

jirka




[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux