From owner-freebsd-hackers@FreeBSD.ORG Wed Jun 17 20:57:52 2015 Return-Path: Delivered-To: freebsd-hackers@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 96283268 for ; Wed, 17 Jun 2015 20:57:52 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ig0-x235.google.com (mail-ig0-x235.google.com [IPv6:2607:f8b0:4001:c05::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5CF94BB3 for ; Wed, 17 Jun 2015 20:57:52 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by igbos3 with SMTP id os3so3256347igb.0 for ; Wed, 17 Jun 2015 13:57:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=ZvNCvLa325unlw3SDKWXu+sQfI5Ym5HDc5kDed5o49U=; b=PfFaKppqTXk2UcD04OdqoEhOQk1YkntKrSBPjldPtTw8qvMpEzOjZui43h448mPsG9 oQLpk7Zu7ZjZqSNcHiAesX2HycYpHdpA7xykAd7Z6t7/Zoith3EVahzV3mqk9MzASjuc 1lwRATqz49sweAQS0AxU0cq5RdnfpRBM+ep0wnYWGkeQBjS65J0oE5mC3idcorn3BMJD IGcDPBPQKSrCBF6n0c3jKmmWXGy1/Xgb0mgyUNUVwz5hpl/r60pf22eAzp+QQtA8g0WD 3e78MzQXz15s/QzZO9boSP9EG3wW5H8aJf+x7wQlwmO7ISO7LLyHAeQqUbVIFxLEkFjP qKMA== MIME-Version: 1.0 X-Received: by 10.107.129.82 with SMTP id c79mr10660605iod.87.1434574671702; Wed, 17 Jun 2015 13:57:51 -0700 (PDT) Received: by 10.107.165.16 with HTTP; Wed, 17 Jun 2015 13:57:51 -0700 (PDT) In-Reply-To: References: Date: Wed, 17 Jun 2015 16:57:51 -0400 Message-ID: Subject: Re: PMCSTAT Event for counting L1-DCache Hit / Misses From: Ryan Stone To: Sai Prajeeth Cc: "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Jun 2015 20:57:52 -0000 On Wed, Jun 17, 2015 at 4:31 PM, Sai Prajeeth wrote: > Intel Xeon X5650 2660.05-MHz K8-class CPU. Family = 0x6 Model = 0x2c > Stepping = 2. > > Pretty sure its Intel Nehalem architecture. > Googling seems to indicate this this is a Westmere, although Intel's site could be much clearer (and really, so could hwpmc -- there should be a sysctl telling you what manpage to look at). If it is Westmere, the manpage is here: https://www.freebsd.org/cgi/man.cgi?query=pmc.westmere&apropos=0&sektion=0&manpath=FreeBSD%209.0-RELEASE&arch=default&format=html These counters are probably what you're looking for. Summing up everything but the L1D_HIT counter should give you the number of misses. It would be nice if hwpmc had a L1D_MISS counter using a umask of 0x5E, which sum things up automatically for you. MEM_LOAD_RETIRED.L1D_HIT (Event CBH, Umask 01H) Counts number of retired loads that hit the L1 data cache. MEM_LOAD_RETIRED.L2_HIT (Event CBH, Umask 02H) Counts number of retired loads that hit the L2 data cache. MEM_LOAD_RETIRED.L3_UNSHARED_HIT (Event CBH, Umask 04H) Counts number of retired loads that hit their own, unshared lines in the L3 cache. MEM_LOAD_RETIRED.OTHER_CORE_L2_HIT_HITM (Event CBH, Umask 08H) Counts number of retired loads that hit in a sibling core's L2 (on die core). Since the L3 is inclusive of all cores on the package, this is an L3 hit. This counts both clean or modified hits. MEM_LOAD_RETIRED.L3_MISS (Event CBH, Umask 10H) Counts number of retired loads that miss the L3 cache. The load was satisfied by a remote socket, local memory or an IOH. MEM_LOAD_RETIRED.HIT_LFB (Event CBH, Umask 40H) Counts number of retired loads that miss the L1D and the address is located in an allocated line fill buffer and will soon be committed to cache. This is counting sec- ondary L1D misses.