From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 34707426AE for ; Tue, 3 Oct 2023 19:18:03 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2658E406BA; Tue, 3 Oct 2023 19:18:03 +0200 (CEST) Received: from mail-oi1-f170.google.com (mail-oi1-f170.google.com [209.85.167.170]) by mails.dpdk.org (Postfix) with ESMTP id 7B78E406BA for ; Tue, 3 Oct 2023 19:18:01 +0200 (CEST) Received: by mail-oi1-f170.google.com with SMTP id 5614622812f47-3af65455e7cso785776b6e.1 for ; Tue, 03 Oct 2023 10:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1696353481; x=1696958281; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=oIPFtN03vn/ch/vshind00V6iwfWlzL7H+BpmgAMnYA=; b=pSe3zFkORLfDtCopvVXkkzyajD1zhyfJvzyQjMgteScyVkWqf7iA2GBF6fqM3aOYdu Qrky7p0UCgCZgG9wyCOreA8H96V071xTedDKTOzIFA+VWV3ONZqpWgvpW/J05LIC+A20 VzhnicoreiZC2Tmq8RC99s4TqLWddJ2FLAblgNcU/wmLeXcMV1fBPInHOaLIwhxYLXhA XeXfY5go0WBSvTb+a+VtNPEwyy10B7ZagqY0rktlcTsT43b007JwJ5qYQ0siyDxJQnfh gagxgWVk5U5ZxBJF+LOBj+ToeZS4QQbyNmaTDfl2Blp2J9oARy6k+BxlXS53gERzWgIk xsPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696353481; x=1696958281; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oIPFtN03vn/ch/vshind00V6iwfWlzL7H+BpmgAMnYA=; b=U99ONpb8bRw/rdu3sl0HB+gE5NkhEZi7LHEKVGo1Txmb4RYNeLHCmRHCKeEpNuSNdi XVHaJJCSkifjgUsUJBf0ymyHE44Im6o+pOaP7LebjIsZ/RHR4WIk6dXxbgiIp4Efxdn3 erUR1UkrGXf5scydE8TiypC9dUXhF0pbU7itXLhy4VoPa1tgHcS8gVBTpm4cRfy+6T2M zon1tJIHo6rBnimgAKtg0+gTjiJhx30pBeZuOMFqvge8RL8g/bcZVEkqOxlFRgu9j1D+ +KveheBWDZmjn6nKcg8Y6Zyw+dP5jM/CaUqge4naiZJBkhcVsaU+CWSjq8CLqNKafW67 YPBA== X-Gm-Message-State: AOJu0YyNfZ7HC0mKqBJP6k7D9sQXW5Bj65e/+yzd7IXX0Lzbirkp4O6h ZSu+ZmI1ZG2OI3X0Uj7tssiO6g== X-Google-Smtp-Source: AGHT+IG1/9yDEk4jK8uDK4meRaSaTDeKPgYWJDv/Enh70B2wuELtSYqFIrD42QFvjAW2GhJWiQU3bw== X-Received: by 2002:a05:6808:1b09:b0:3ab:843f:76fd with SMTP id bx9-20020a0568081b0900b003ab843f76fdmr264211oib.19.1696353480808; Tue, 03 Oct 2023 10:18:00 -0700 (PDT) Received: from hermes.local (204-195-126-68.wavecable.com. [204.195.126.68]) by smtp.gmail.com with ESMTPSA id 14-20020a17090a000e00b00273744e6eccsm1764895pja.12.2023.10.03.10.18.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Oct 2023 10:18:00 -0700 (PDT) Date: Tue, 3 Oct 2023 10:17:58 -0700 From: Stephen Hemminger To: Hari Haran Cc: users@dpdk.org Subject: Re: rte_rdtsc() - what is the performance impact of using rte_rdtsc() time Message-ID: <20231003101758.212f1352@hermes.local> In-Reply-To: References: <20230905162929.3dbc9e12@hermes.local> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: users@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK usage discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: users-bounces@dpdk.org On Tue, 3 Oct 2023 15:49:00 +0530 Hari Haran wrote: > > > > The problem is that rte_rdtsc() stops speculative execution so doing > > lots of TSC instructions can hurt performance. > > > > To correlate TSC timestamp to system time, you need to compute the offsets > > once at startup. Alternatively, don't use rte_rdtsc() and instead use > > clock_gettime() with the monotonic timer and the C library does the > > calculation > > for you. > > > > > As part of query 1 and based on your response, I am asking below query > > But usage of clock_gettime() (kernel function) in lcore is advisable one? > My understanding is, > shall avoid usage of kernel function in lcore. Correct me if I am wrong? clock_gettime() is a virtual system call (VDSO) on most Linux platforms. But it is still slower than simple rte_rdtsc(). Internally clock_gettime VDSO