Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754114AbbGWQAs (ORCPT ); Thu, 23 Jul 2015 12:00:48 -0400 Received: from mail-wi0-f173.google.com ([209.85.212.173]:33401 "EHLO mail-wi0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752255AbbGWQAk (ORCPT ); Thu, 23 Jul 2015 12:00:40 -0400 MIME-Version: 1.0 In-Reply-To: References: <1437407346-31186-1-git-send-email-kan.liang@intel.com> <20150721095524.GK19282@twins.programming.kicks-ass.net> Date: Thu, 23 Jul 2015 09:00:37 -0700 Message-ID: Subject: Re: [PATCH RFC V2 1/1] x86, perf: Add a freq pmu driver From: Stephane Eranian To: Andy Lutomirski Cc: Peter Zijlstra , Kan Liang , "mingo@redhat.com" , Arnaldo Carvalho de Melo , "ak@linux.intel.com" , Mark Rutland , Adrian Hunter , David Ahern , Jiri Olsa , Namhyung Kim , LKML , Andy Lutomirski 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: 1822 Lines: 39 On Thu, Jul 23, 2015 at 8:52 AM, Andy Lutomirski wrote: > On Thu, Jul 23, 2015 at 8:44 AM, Stephane Eranian wrote: >> I understand the value of the tsc and smi events. It is not >> clear to me what aperf/mperf buys you over cycles and ref-cycles: >> >> $ perf stat -a -e msr/aperf/,msr/mperf/,cycles,ref-cycles -C 1 -I 1000 sleep 10 >> # time counts unit events >> 2.000361718 14,826,353 msr/aperf/ >> 2.000361718 11,865,170 msr/mperf/ >> 2.000361718 17,170,101 cycles >> 2.000361718 13,629,675 ref-cycles >> >> Only the ratio aperf/mperf is defined, here 1.25 and the ratio >> cycles/ref-cycles is 1.25 as well. So what is a situation where >> aperf/mperf provides better info than cycles/ref-cycles? >> The SDM also says aperf/mperf only defined when running in C0 mode. > > They're free-running and always on, which means that you can never > fail to schedule them. > You get the same with cycles and ref-cycles. They can both run on fixed-counters. So you can always schedule them. If you cannot, then it means you are already measuring them. The only case I can see where there is a benefit is if you have a competing system-wide and per-thread sessions and the former is already using all the generic counters + fixed and you come in with a per-thread event to measure cycles or ref-cycles. That would be rejected but aperf/mperf would not. But that would only work if you are counting. There would be no benefits for sampling mode. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/