From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ob0-f172.google.com (mail-ob0-f172.google.com [209.85.214.172]) by dpdk.org (Postfix) with ESMTP id 41C2268D9 for ; Mon, 24 Mar 2014 22:02:23 +0100 (CET) Received: by mail-ob0-f172.google.com with SMTP id wm4so6429180obc.17 for ; Mon, 24 Mar 2014 14:03:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=5uGkuuzOZPrZ4AVqHTxsuRt5Dy0JBS+C3j/Jqtd8D/w=; b=C/EoQpmUBduyWlCh95wXAEg0Ap9n50uMoeHnRfsiJitdh4CVjsApa7Y6nh7+DlA7N1 J+yvAAn7vcLg5rOqENFAmBO75uHGocsna9qUdqEWPLMC/mMmVvmWHRhTyRIRBPBt3MLv lgzQIvvmzPclgOXdPOtZY+d/JyVjMb2Z1aOpHAG9llb8USA0vd9t8+9/KviLcr6icBEe yEmlyPdJiakx5RygePyFY2Qj7cGCC7Z1p8QzYTQai0WCZbdts1cWhCJRGV/ESsvD0iTh qE8PQiy1acoYoQXI2K8nMfmcMt3TjaBqLCZS91B4hgtlSNJUHbH2c0CFIqX0WYv+qQ+x Ma9w== MIME-Version: 1.0 X-Received: by 10.60.120.34 with SMTP id kz2mr2743050oeb.76.1395695035882; Mon, 24 Mar 2014 14:03:55 -0700 (PDT) Received: by 10.76.22.7 with HTTP; Mon, 24 Mar 2014 14:03:55 -0700 (PDT) Date: Mon, 24 Mar 2014 22:03:55 +0100 Message-ID: From: Jun Han To: "dev@dpdk.org" Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: [dpdk-dev] Question regarding rte_rdtsc_precise() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Mar 2014 21:02:23 -0000 I have a question regarding rte_rdtsc_precise() function. I was not getting an expected number from the normal rte_rdtsc(), and hence changed to rte_rdtsc_precise() function and am getting a different value, which seems to be producing a number close to my expectation. Q1. However, I wanted to ask if how I am using the function is correct. I am attaching a code snippet below. Is this the correct way to use rte_rdtsc_precise() or if I need other things (e.g., adding lfence before and after for instance?) begin = rte_rdtsc_precise(); .... do something... total_time = rte_rdtsc_precise() - begin; printf("%g cyc\n",(double)total_time); Q2. Am I correct that the rte_rdtsc_precise() makes the rdtsc a serializing instruction? Q3. I found from some sources online that there needs to be about ~ 1000 cycles between consecutive rdtsc() calls to get a more accurate measurement [1]. Is this true? If so, is this necessary for your rte_rdtsc_precise()? [1] http://software.intel.com/en-us/forums/topic/305287 "For best results, make sure you have at least ~1,000 clocks worth of instructions between consecutive rdtsc calls." Thank you.