Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965968AbcKOE6R (ORCPT ); Mon, 14 Nov 2016 23:58:17 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:34880 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965813AbcKOE6P (ORCPT ); Mon, 14 Nov 2016 23:58:15 -0500 MIME-Version: 1.0 From: Alexei Starovoitov Date: Mon, 14 Nov 2016 20:57:53 -0800 Message-ID: Subject: Re: [PATCH 00/34] perf clang: Builtin clang and perfhook support To: Wang Nan Cc: Arnaldo Carvalho de Melo , Alexei Starovoitov , Zefan Li , He Kuang , "linux-kernel@vger.kernel.org" , pi3orama , Jiri Olsa Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1062 Lines: 28 On Mon, Nov 14, 2016 at 8:05 PM, Wang Nan wrote: > This is version 2 of perf builtin clang patch series. Compare to v1, > add an exciting feature: jit compiling perf hook functions. This > features allows script writer report result through BPF map in a > customized way. looks great. > SEC("perfhook:record_start") > void record_start(void *ctx) > { > int perf_pid = getpid(), key = G_perf_pid; > printf("Start count, perfpid=%d\n", perf_pid); > jit_helper__map_update_elem(ctx, &GVALS, &key, &perf_pid, 0); the name, I think, is too verbose. Why not to keep them as bpf_map_update_elem even for user space programs? > SEC("perfhook:record_end") > void record_end(void *ctx) > { > u64 key = -1, value; > while (!jit_helper__map_get_next_key(ctx, &syscall_counter, &key, &key)) { > jit_helper__map_lookup_elem(ctx, &syscall_counter, &key, &value); > printf("syscall %ld\tcount: %ld\n", (long)key, (long)value); this loop will be less verbose as well.