Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/87902/?format=api
http://patches.dpdk.org/api/patches/87902/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/patch/20210214021616.26970-2-dmitry.kozliuk@gmail.com/", "project": { "id": 1, "url": "http://patches.dpdk.org/api/projects/1/?format=api", "name": "DPDK", "link_name": "dpdk", "list_id": "dev.dpdk.org", "list_email": "dev@dpdk.org", "web_url": "http://core.dpdk.org", "scm_url": "git://dpdk.org/dpdk", "webscm_url": "http://git.dpdk.org/dpdk", "list_archive_url": "https://inbox.dpdk.org/dev", "list_archive_url_format": "https://inbox.dpdk.org/dev/{}", "commit_url_format": "" }, "msgid": "<20210214021616.26970-2-dmitry.kozliuk@gmail.com>", "list_archive_url": "https://inbox.dpdk.org/dev/20210214021616.26970-2-dmitry.kozliuk@gmail.com", "date": "2021-02-14T02:16:11", "name": "[v2,1/6] eal: add internal API for current time", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": true, "hash": "7f4bd86657ae507bf744ecdc32a04f46608147bf", "submitter": { "id": 1581, "url": "http://patches.dpdk.org/api/people/1581/?format=api", "name": "Dmitry Kozlyuk", "email": "dmitry.kozliuk@gmail.com" }, "delegate": { "id": 319, "url": "http://patches.dpdk.org/api/users/319/?format=api", "username": "fyigit", "first_name": "Ferruh", "last_name": "Yigit", "email": "ferruh.yigit@amd.com" }, "mbox": "http://patches.dpdk.org/project/dpdk/patch/20210214021616.26970-2-dmitry.kozliuk@gmail.com/mbox/", "series": [ { "id": 15257, "url": "http://patches.dpdk.org/api/series/15257/?format=api", "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=15257", "date": "2021-02-14T02:16:10", "name": "net/pcap: build on Windows", "version": 2, "mbox": "http://patches.dpdk.org/series/15257/mbox/" } ], "comments": "http://patches.dpdk.org/api/patches/87902/comments/", "check": "success", "checks": "http://patches.dpdk.org/api/patches/87902/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<dev-bounces@dpdk.org>", "X-Original-To": "patchwork@inbox.dpdk.org", "Delivered-To": "patchwork@inbox.dpdk.org", "Received": [ "from mails.dpdk.org (mails.dpdk.org [217.70.189.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2483CA0546;\n\tSun, 14 Feb 2021 03:16:34 +0100 (CET)", "from [217.70.189.124] (localhost [127.0.0.1])\n\tby mails.dpdk.org (Postfix) with ESMTP id E161B1CC4FA;\n\tSun, 14 Feb 2021 03:16:29 +0100 (CET)", "from mail-lj1-f179.google.com (mail-lj1-f179.google.com\n [209.85.208.179])\n by mails.dpdk.org (Postfix) with ESMTP id 240921CC4DA\n for <dev@dpdk.org>; Sun, 14 Feb 2021 03:16:28 +0100 (CET)", "by mail-lj1-f179.google.com with SMTP id k22so3058896ljg.3\n for <dev@dpdk.org>; Sat, 13 Feb 2021 18:16:28 -0800 (PST)", "from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru.\n [37.110.65.23])\n by smtp.gmail.com with ESMTPSA id l19sm3017158lji.53.2021.02.13.18.16.26\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Sat, 13 Feb 2021 18:16:27 -0800 (PST)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=lqHnc/gk+WRoUiAhgV7JNfW0MR5h6LzcLQ4WRFpUXBA=;\n b=jYsuPonK3CRNsdMmm03UvxJ/2LHo96w4GqEHYaqKDQCAzbqgiwBlJvDBFUaX4xWAvW\n ez0XSmFBv440+1m1479nW9rnbjowBpugZMKtxPC+yVV0o9EbRSPsa2CYZlnnQ0ZKSf+k\n b69AUYnqx1ZwEE3d0qwcdpw9G+8+epUqq9rRbDCaKNG3PsmLr/N+uMJf33UvkMBCCdjV\n 6FuAHdmfq2f8kjgmG/1QLU57R3otbUSCIZ6/MJTimh30NB9ix2x5KMbgocnf+RPeOGXM\n K9/BfF4vvcdczOD7JqSgqAEMronCCq1D81jNtHZeiL9iLBLXg7sQ0RgHNKX1FcQpFhYH\n /Lcg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=lqHnc/gk+WRoUiAhgV7JNfW0MR5h6LzcLQ4WRFpUXBA=;\n b=SN4x4knjCZQm6eRch3vCyKQCib5WgWJv70zhV/AyZxKTVxYDaL379YV/kNtawnCzTl\n 0eQNZ2TyaARt0cQYcoOWgDdIUvp5VZ5Z+RDQ3+XnD95Ajx22xbSRe5E5XtwmCljxV3iK\n kyF06Kswweb3rZtLe/N9tIPp2Pd4I4RAmU8oqwGm813HTFJzxfOSxUYiFsiMa1HzaIjS\n gfIlc3v6YX2WITlYdjf2DKnBlwbQvVpbF2ysoj3eTXzxEs7PD6F8Fl1LkOa1BKh+Xzg/\n nVkwxGrBZHdcD5G0I7UeIqROp7iJpZhHLz5qTE3fRJmzIeQIR0ERD6h2PYyNbOTNWf6A\n 546g==", "X-Gm-Message-State": "AOAM532SuSo9a7mLxa4M45qOKb9AwjfXP3w6U6BBGHadQ7qqRnxs+wlf\n 8kfxaJHhtrEwd65J/HyhbPJyE1SM70sNtg==", "X-Google-Smtp-Source": "\n ABdhPJwRTuRvK7SzauoCN1o6qTL30P2GDIDRVm23t8YbCvjEKau7wz9bkOT8BFA2VBLYU5LzCwDidA==", "X-Received": "by 2002:a2e:8005:: with SMTP id j5mr5666453ljg.34.1613268987424;\n Sat, 13 Feb 2021 18:16:27 -0800 (PST)", "From": "Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>", "To": "dev@dpdk.org", "Cc": "Tyler Retzlaff <roretzla@microsoft.com>,\n Mike Wells <mike.wells@telchemy.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Narcisa Ana Maria Vasile <navasile@linux.microsoft.com>,\n Dmitry Malloy <dmitrym@microsoft.com>,\n Pallavi Kadam <pallavi.kadam@intel.com>, Ray Kinsella <mdr@ashroe.eu>,\n Neil Horman <nhorman@tuxdriver.com>", "Date": "Sun, 14 Feb 2021 05:16:11 +0300", "Message-Id": "<20210214021616.26970-2-dmitry.kozliuk@gmail.com>", "X-Mailer": "git-send-email 2.29.2", "In-Reply-To": "<20210214021616.26970-1-dmitry.kozliuk@gmail.com>", "References": "<20210214012013.23165-1-dmitry.kozliuk@gmail.com>\n <20210214021616.26970-1-dmitry.kozliuk@gmail.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[dpdk-dev] [PATCH v2 1/6] eal: add internal API for current time", "X-BeenThere": "dev@dpdk.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "DPDK patches and discussions <dev.dpdk.org>", "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>", "List-Archive": "<http://mails.dpdk.org/archives/dev/>", "List-Post": "<mailto:dev@dpdk.org>", "List-Help": "<mailto:dev-request@dpdk.org?subject=help>", "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>", "Errors-To": "dev-bounces@dpdk.org", "Sender": "\"dev\" <dev-bounces@dpdk.org>" }, "content": "Many PMDs use POSIX gettimeofday(). Add rte_time_get_us() function\nto obtain current time with microsecond precision on all platforms.\n\nSigned-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n---\n lib/librte_eal/include/rte_time.h | 17 +++++++++++++++++\n lib/librte_eal/rte_eal_exports.def | 1 +\n lib/librte_eal/unix/eal_unix_timer.c | 13 +++++++++++++\n lib/librte_eal/version.map | 1 +\n lib/librte_eal/windows/eal_timer.c | 21 ++++++++++++++++++++-\n 5 files changed, 52 insertions(+), 1 deletion(-)", "diff": "diff --git a/lib/librte_eal/include/rte_time.h b/lib/librte_eal/include/rte_time.h\nindex 5ad7c8841..50fa4f889 100644\n--- a/lib/librte_eal/include/rte_time.h\n+++ b/lib/librte_eal/include/rte_time.h\n@@ -8,6 +8,8 @@\n #include <stdint.h>\n #include <time.h>\n \n+#include <rte_compat.h>\n+\n #define NSEC_PER_SEC 1000000000L\n \n /**\n@@ -98,4 +100,19 @@ rte_ns_to_timespec(uint64_t nsec)\n \treturn ts;\n }\n \n+/* Point of time with microsecond precision. */\n+struct rte_time_us {\n+\tint64_t sec; /**< Number of whole seconds. */\n+\tint64_t usec; /**< Fractional part of second in [0, 999999]. */\n+};\n+\n+/**\n+ * Get current system time.\n+ *\n+ * @param now\n+ * Receives current system time.\n+ */\n+__rte_internal\n+void rte_time_get_us(struct rte_time_us *now);\n+\n #endif /* _RTE_TIME_H_ */\ndiff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def\nindex 474cf123f..cb691f7bc 100644\n--- a/lib/librte_eal/rte_eal_exports.def\n+++ b/lib/librte_eal/rte_eal_exports.def\n@@ -334,3 +334,4 @@ EXPORTS\n \trte_mem_map\n \trte_mem_page_size\n \trte_mem_unmap\n+\trte_time_get_us\ndiff --git a/lib/librte_eal/unix/eal_unix_timer.c b/lib/librte_eal/unix/eal_unix_timer.c\nindex cc5015910..5612fdebe 100644\n--- a/lib/librte_eal/unix/eal_unix_timer.c\n+++ b/lib/librte_eal/unix/eal_unix_timer.c\n@@ -4,7 +4,10 @@\n \n #include <time.h>\n \n+#include <sys/time.h>\n+\n #include <rte_cycles.h>\n+#include <rte_time.h>\n \n void\n rte_delay_us_sleep(unsigned int us)\n@@ -27,3 +30,13 @@ rte_delay_us_sleep(unsigned int us)\n \t\tind = 1 - ind;\n \t}\n }\n+\n+void\n+rte_time_get_us(struct rte_time_us *now)\n+{\n+\tstruct timeval sys;\n+\n+\tgettimeofday(&sys, NULL);\n+\tnow->sec = sys.tv_sec;\n+\tnow->usec = sys.tv_usec;\n+}\ndiff --git a/lib/librte_eal/version.map b/lib/librte_eal/version.map\nindex fce90a112..405bed766 100644\n--- a/lib/librte_eal/version.map\n+++ b/lib/librte_eal/version.map\n@@ -421,4 +421,5 @@ INTERNAL {\n \trte_mem_map;\n \trte_mem_page_size;\n \trte_mem_unmap;\n+\trte_time_get_us;\n };\ndiff --git a/lib/librte_eal/windows/eal_timer.c b/lib/librte_eal/windows/eal_timer.c\nindex b070cb775..a5c42106a 100644\n--- a/lib/librte_eal/windows/eal_timer.c\n+++ b/lib/librte_eal/windows/eal_timer.c\n@@ -9,6 +9,7 @@\n #include <rte_cycles.h>\n #include <rte_eal.h>\n #include <rte_errno.h>\n+#include <rte_time.h>\n #include \"eal_private.h\"\n \n #define US_PER_SEC 1E6\n@@ -85,10 +86,28 @@ get_tsc_freq(void)\n \treturn RTE_ALIGN_MUL_NEAR(tsc_hz, CYC_PER_10MHZ);\n }\n \n-\n int\n rte_eal_timer_init(void)\n {\n \tset_tsc_freq();\n \treturn 0;\n }\n+\n+void\n+rte_time_get_us(struct rte_time_us *now)\n+{\n+\t/* 100ns ticks from 1601-01-01 to 1970-01-01 */\n+\tstatic const uint64_t EPOCH = 116444736000000000ULL;\n+\tstatic const uint64_t TICKS_PER_USEC = 10;\n+\tstatic const uint64_t USEC_PER_SEC = 1000000;\n+\n+\tFILETIME ft;\n+\tuint64_t ticks, sec;\n+\n+\tGetSystemTimePreciseAsFileTime(&ft);\n+\tticks = ((uint64_t)ft.dwHighDateTime << 32) | ft.dwLowDateTime;\n+\tticks -= EPOCH;\n+\tsec = ticks / (TICKS_PER_USEC * USEC_PER_SEC);\n+\tnow->sec = sec;\n+\tnow->usec = ticks / TICKS_PER_USEC - sec * USEC_PER_SEC;\n+}\n", "prefixes": [ "v2", "1/6" ] }{ "id": 87902, "url": "