Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp2995456ybj; Mon, 23 Sep 2019 12:52:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqw1s0NfihY+OAQsEAgz1Uu0MCS9FG1/c/mZcrRVUPnj+T/TUMOFupSfdmKpxYftms0GnZMI X-Received: by 2002:a17:906:c721:: with SMTP id fj1mr1327046ejb.177.1569268378326; Mon, 23 Sep 2019 12:52:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569268378; cv=none; d=google.com; s=arc-20160816; b=CW8QmipK4fTFl9+nm7o7reHSjNi27vFRUh+BbydyXsIdGsDVwJDDORAcNFk9rRXqcC YXcS+BwpcEwWpXAmrR2ARm0hCZ91aNA1gLQZ6j9diww5n8fHesf/wOoiAJQpegJOGCZY m1LrvEZQXfpEzSlINrkxnETJoWmqn5l4yVlD/PjIcpwfhJA5p7OoRkGCvUTXqpFJbCrl vnW/1xjVDymekQDj+Gp2IvJ7ct6cmoy06W3qoUP/LAaN8u1wUVnGqRT2FAZ2f6jMyoEZ /a8vM2UJq7DONbNVPct06Xql0RQb5Zkmbm3gie6ZlskCBkCQd0K8BilD5cKCgi5SDaKR U7bw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=3TvFYlh3ZDdAmS5hErxE7vw1s7y4UJTU7GsZAqYmL6c=; b=T5mW/LPZ1YFPH7xLJ8qLihK7hIgQZXBkDA3awheWcM1Ftg1AxPR0nNOe5UcpvOmU4V dVARGjChF8xdZd+DV+iVTRAZp2WsT6EgvBcDEs7x7RKdunFrTcs9jeMx6DfhBFxk4mKi ahW8neWd8VbchXx99+rRT0B4ZppR+FvykjqyQlt/edwCKMZmkdHbYbkspZU+nWPY3HPi IcmPIfvYu7v+yAWjQHwTtuDv0vSao626ZcHbJ62FJSX76v03Or471tXHpBynezpzdOrI DjLZS0y4X8odiqYqfiBGUZ6Cdj+PfbFqeqG4nK8zh4dSz5XhXnKHkaqcA6Ul/xMcV1BZ yJ2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si7983429edi.442.2019.09.23.12.52.34; Mon, 23 Sep 2019 12:52:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387416AbfIVOrL (ORCPT + 99 others); Sun, 22 Sep 2019 10:47:11 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49390 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729072AbfIVOrK (ORCPT ); Sun, 22 Sep 2019 10:47:10 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0CC2110CC1E3; Sun, 22 Sep 2019 14:47:10 +0000 (UTC) Received: from krava (ovpn-204-75.brq.redhat.com [10.40.204.75]) by smtp.corp.redhat.com (Postfix) with SMTP id 8713319C78; Sun, 22 Sep 2019 14:47:06 +0000 (UTC) Date: Sun, 22 Sep 2019 16:47:05 +0200 From: Jiri Olsa To: Arnaldo Carvalho de Melo Cc: Jiri Olsa , Kan Liang , Steven Rostedt , Adrian Hunter , Ian Rogers , Stephane Eranian , Song Liu , Alexey Budankov , Andi Kleen , lkml , Ingo Molnar , Namhyung Kim , Alexander Shishkin , Peter Zijlstra , Michael Petlan Subject: Re: [RFC 00/73] libperf: Add sampling interface Message-ID: <20190922144705.GA17104@krava> References: <20190913132355.21634-1-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190913132355.21634-1-jolsa@kernel.org> User-Agent: Mutt/1.12.1 (2019-06-15) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.65]); Sun, 22 Sep 2019 14:47:10 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 13, 2019 at 03:22:42PM +0200, Jiri Olsa wrote: > hi, > sending changes for exporting basic sampling interface > in libperf. It's now possible to use following code in > applications via libperf: > > --- (example is without error checks for simplicity) > > struct perf_event_attr attr = { > .type = PERF_TYPE_TRACEPOINT, > .sample_period = 1, > .wakeup_watermark = 1, > .disabled = 1, > }; > /* ... setup attr */ > > cpus = perf_cpu_map__new(NULL); > > evlist = perf_evlist__new(); > evsel = perf_evsel__new(&attr); > perf_evlist__add(evlist, evsel); > > perf_evlist__set_maps(evlist, cpus, NULL); > > err = perf_evlist__open(evlist); > err = perf_evlist__mmap(evlist, 4); > > err = perf_evlist__enable(evlist); > > /* ... monitored area, plus all the other cpus */ > > err = perf_evlist__disable(evlist); > > perf_evlist__for_each_mmap(evlist, map) { > if (perf_mmap__read_init(map) < 0) > continue; > > while ((event = perf_mmap__read_event(map)) != NULL) { > perf_mmap__consume(map); > } > > perf_mmap__read_done(map); > } > > perf_evlist__delete(evlist); > perf_cpu_map__put(cpus); > > --- (end) > > Nothing is carved in stone so far, the interface is exported > as is available in perf now and we can change it as we want. > > New tests are added in test-evlist.c to do thread and cpu based > sampling. > > All the functionality should not change, however there's considerable > mmap code rewrite, so would be great if guys could run your usual > workloads to see if all is fine.. so far so good in my tests ;-) > > It's also available in here: > git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git > perf/lib hi, I rebased the branch to latest Arnaldo's perf/core branch jirka