From patchwork Wed Jan 31 14:00:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126342 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp770231ljc; Wed, 31 Jan 2018 06:15:41 -0800 (PST) X-Google-Smtp-Source: AH8x2240hqzWiY+zz8yOE/4j+fCP3YQKFp4fUGggDvwARzKWGuU/xVbD1euX2LGKgjoIziH2EWlW X-Received: by 10.200.39.71 with SMTP id h7mr52090917qth.198.1517408141227; Wed, 31 Jan 2018 06:15:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408141; cv=none; d=google.com; s=arc-20160816; b=PTuwiTYgx+pd/OFArmahy5jRZnbORRrFwUDrQYRmZZIXqYuURbskSB4MHL1GG7JBTI s7+8q1gvCf70GIy33oHu64qRlLFOetmnPrMdA865TcjLcb5s7p7jxXoDL360rVandSyl yivuedT+0VPvlIr5WolJqMkVXbqz1gwUvqK8A4JWhlvUYcwbuBlySonldMu1JVrjmCHP 5LP4UcFkJHa7QEP+OyQP+M6ejeCMdRcvTPZrX3MvhXDkBo89twFBavUudNclrQVd76px 7zLd3gryYJvbcCrj8sCEtOBXPnR0w0hUOOdXbBsEeqlRKWfQBrVfCQuBaCEWCiUbeAHn qgMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=40KPQZOF8vCR/FA72MH86oRaxZ7Hg0YoTQMDp1DZcwk=; b=XYn4eVF68sW5WWfuXiOPAHSMOeaKRhjPOZpGT2OkzRD+J3RDRe9VU7Cm95Ahxc4sF4 EBtKN95UEQ9BMpVZ1hVP0/32ZgJQ0h8ICSIaZmlIn8OdKCh5AWG/zBpiPZQ/3sP2Wgqm IvzrN/qQLQb9OnpOZ2xT+38MEIwzMTUc0Ls51wvybtiik1gRqplUz5VGQjNm1jEnlXJ0 mhmybv3kHDF8WsUnlJ8jOwBVOuEiDK7uJmv2thK0ErVUasxH0AccAMtnBdF2ilQpBMoy YQPUnIjE2jRCzi9M4Pl9HuLzaJX8dVnXNskfUi2UykFV0E8IJsLOGywv3Kf85ZqNwqg/ eFWw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n15si4000172qki.387.2018.01.31.06.15.40; Wed, 31 Jan 2018 06:15:41 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id DDDB1617B6; Wed, 31 Jan 2018 14:15:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0CE0261788; Wed, 31 Jan 2018 14:03:26 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 47422617DD; Wed, 31 Jan 2018 14:03:12 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id EB09561783 for ; Wed, 31 Jan 2018 14:00:37 +0000 (UTC) Received: from mxback1o.mail.yandex.net (mxback1o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::1b]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 4B4694302F13 for ; Wed, 31 Jan 2018 17:00:36 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback1o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id iaNpJnUgFW-0aUitq6A; Wed, 31 Jan 2018 17:00:36 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Tps9JIjLUO-0ZqCxwOB; Wed, 31 Jan 2018 17:00:35 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:28 +0300 Message-Id: <1517407234-19273-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> References: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v4 1/7] api: packet: add protocol type enumeration X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Add enumerations for L3 and L4 protocol types, and functions to request those. Signed-off-by: Petri Savolainen --- /** Email created from pull request 403 (psavol:next-ipsec-tfc) ** https://github.com/Linaro/odp/pull/403 ** Patch: https://github.com/Linaro/odp/pull/403.patch ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de **/ include/odp/api/abi-default/packet.h | 28 +++++++ include/odp/api/spec/packet.h | 95 ++++++++++++++++++++++ .../linux-generic/include-abi/odp/api/abi/packet.h | 28 +++++++ 3 files changed, 151 insertions(+) diff --git a/include/odp/api/abi-default/packet.h b/include/odp/api/abi-default/packet.h index 3d6876731..349b6b1fa 100644 --- a/include/odp/api/abi-default/packet.h +++ b/include/odp/api/abi-default/packet.h @@ -30,6 +30,34 @@ typedef _odp_abi_packet_seg_t *odp_packet_seg_t; #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)0xffffffff) #define ODP_PACKET_OFFSET_INVALID 0xffff +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROCH 142 + typedef enum { ODP_PACKET_GREEN = 0, ODP_PACKET_YELLOW = 1, diff --git a/include/odp/api/spec/packet.h b/include/odp/api/spec/packet.h index 3222ff5c2..6f6aa0658 100644 --- a/include/odp/api/spec/packet.h +++ b/include/odp/api/spec/packet.h @@ -71,6 +71,79 @@ extern "C" { * Packet is red */ +/** + * @typedef odp_proto_l3_type_t + * Layer 3 protocol type + */ + +/** + * @def ODP_PROTO_L3_TYPE_NONE + * Layer 3 protocol type not defined + * + * @def ODP_PROTO_L3_TYPE_ARP + * Layer 3 protocol is ARP + * + * @def ODP_PROTO_L3_TYPE_RARP + * Layer 3 protocol is RARP + * + * @def ODP_PROTO_L3_TYPE_MPLS + * Layer 3 protocol is MPLS + * + * @def ODP_PROTO_L3_TYPE_IPV4 + * Layer 3 protocol type is IPv4 + * + * @def ODP_PROTO_L3_TYPE_IPV6 + * Layer 3 protocol type is IPv6 + */ + +/** + * @def ODP_PROTO_L4_TYPE_NONE + * Layer 4 protocol type not defined + * + * @def ODP_PROTO_L4_TYPE_ICMPV4 + * Layer 4 protocol type is ICMPv4 + * + * @def ODP_PROTO_L4_TYPE_IGMP + * Layer 4 protocol type is IGMP + * + * @def ODP_PROTO_L4_TYPE_IPV4 + * Layer 4 protocol type is IPv4 + * + * @def ODP_PROTO_L4_TYPE_TCP + * Layer 4 protocol type is TCP + * + * @def ODP_PROTO_L4_TYPE_UDP + * Layer 4 protocol type is UDP + * + * @def ODP_PROTO_L4_TYPE_IPV6 + * Layer 4 protocol type is IPv6 + * + * @def ODP_PROTO_L4_TYPE_GRE + * Layer 4 protocol type is GRE + * + * @def ODP_PROTO_L4_TYPE_ESP + * Layer 4 protocol type is IPSEC ESP + * + * @def ODP_PROTO_L4_TYPE_AH + * Layer 4 protocol type is IPSEC AH + * + * @def ODP_PROTO_L4_TYPE_ICMPV6 + * Layer 4 protocol type is ICMPv6 + * + * @def ODP_PROTO_L4_TYPE_NO_NEXT + * Layer 4 protocol type is "No Next Header". + * Protocol / next header number is 59. + * + * @def ODP_PROTO_L4_TYPE_IPCOMP + * Layer 4 protocol type is IP Payload Compression Protocol + * + * @def ODP_PROTO_L4_TYPE_SCTP + * Layer 4 protocol type is SCTP + * + * @def ODP_PROTO_L4_TYPE_ROCH + * Layer 4 protocol type is ROCH + */ + /** * Protocol */ @@ -1542,6 +1615,28 @@ uint32_t odp_packet_l4_offset(odp_packet_t pkt); */ int odp_packet_l4_offset_set(odp_packet_t pkt, uint32_t offset); +/** + * Layer 3 protocol type + * + * Returns layer 3 protocol type. Initial type value is ODP_PROTO_L3_TYPE_NONE. + * + * @param pkt Packet handle + * + * @return Layer 3 protocol type + */ +odp_proto_l3_type_t odp_packet_l3_type(odp_packet_t pkt); + +/** + * Layer 4 protocol type + * + * Returns layer 4 protocol type. Initial type value is ODP_PROTO_L4_TYPE_NONE. + * + * @param pkt Packet handle + * + * @return Layer 4 protocol type + */ +odp_proto_l4_type_t odp_packet_l4_type(odp_packet_t pkt); + /** * Layer 3 checksum check status * diff --git a/platform/linux-generic/include-abi/odp/api/abi/packet.h b/platform/linux-generic/include-abi/odp/api/abi/packet.h index 1aa7cbd58..c68ac7b48 100644 --- a/platform/linux-generic/include-abi/odp/api/abi/packet.h +++ b/platform/linux-generic/include-abi/odp/api/abi/packet.h @@ -47,6 +47,34 @@ static inline odp_packet_seg_t _odp_packet_seg_from_ndx(uint8_t ndx) #define ODP_PACKET_SEG_INVALID ((odp_packet_seg_t)-1) +typedef uint8_t odp_proto_l3_type_t; + +#define ODP_PROTO_L3_TYPE_NONE 0 +#define ODP_PROTO_L3_TYPE_ARP 1 +#define ODP_PROTO_L3_TYPE_RARP 2 +#define ODP_PROTO_L3_TYPE_MPLS 3 +#define ODP_PROTO_L3_TYPE_IPV4 4 +#define ODP_PROTO_L3_TYPE_IPV6 6 + +typedef uint8_t odp_proto_l4_type_t; + +/* Numbers from IANA Assigned Internet Protocol Numbers list */ +#define ODP_PROTO_L4_TYPE_NONE 0 +#define ODP_PROTO_L4_TYPE_ICMPV4 1 +#define ODP_PROTO_L4_TYPE_IGMP 2 +#define ODP_PROTO_L4_TYPE_IPV4 4 +#define ODP_PROTO_L4_TYPE_TCP 6 +#define ODP_PROTO_L4_TYPE_UDP 17 +#define ODP_PROTO_L4_TYPE_IPV6 41 +#define ODP_PROTO_L4_TYPE_GRE 47 +#define ODP_PROTO_L4_TYPE_ESP 50 +#define ODP_PROTO_L4_TYPE_AH 51 +#define ODP_PROTO_L4_TYPE_ICMPV6 58 +#define ODP_PROTO_L4_TYPE_NO_NEXT 59 +#define ODP_PROTO_L4_TYPE_IPCOMP 108 +#define ODP_PROTO_L4_TYPE_SCTP 132 +#define ODP_PROTO_L4_TYPE_ROCH 142 + typedef enum { ODP_PACKET_GREEN = 0, ODP_PACKET_YELLOW = 1, From patchwork Wed Jan 31 14:00:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126343 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp771208ljc; Wed, 31 Jan 2018 06:16:43 -0800 (PST) X-Google-Smtp-Source: AH8x224y6nRl7npYatJahiMFVt8LPNH4A9xr5rrtrCcThIOUCD4AnLFOI03PgFs6rmuagZR4CWF6 X-Received: by 10.200.15.83 with SMTP id l19mr53800136qtk.45.1517408203737; Wed, 31 Jan 2018 06:16:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408203; cv=none; d=google.com; s=arc-20160816; b=GTLmtu4CbmQlp5JQQtY2hRsrTGAsbD2yydeSKANdJKDQV9WYrIjsGbhniZy73L9fJN PyQEp//Ncp7m3rACJ92lBQVePj+bxnCHOgBdlHgfqEauRbgmB91IT55EoPjH0qYDRnSA sEhsr0Badxz3ar3cP1Z1lty6iI0G+EBdAX9Cd1tJovCdP2eOeoA4qUogzzhXxEHNKPyY Fc1ohv4at1lQN5zjMxx1GRCdApx3TI9ejeLKn9mR4Dpepvmkq+duHLMT7kcCOoOJLTyE LvNz/JTTM6INuYhz240Vr7TaWrHPCi7vBO5eaDu94RxcZdOFTghqnC8fmGopTXINC86O ANng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=B440pTQC8IXVYnXWBYQo/mzD1CWL0yoTT8qEow628u8=; b=bV0nP5xbbZTdvEJJcBKD8bGXDlzzKMLsQt5wdM6JjAKsBXzflk2U8WNxImCh6MNn6n TTaqaZpRmqGg1MPCQeaTf2/wQZqIXja2NaNAFAtdZuT1UoaRt9fx8H6kCROEdXZ6Ix8K qgrYBQJSHoLK0y5Y+QrcrgFf7J0TwvJHKsB7MzyrB8f2RtTro0SQhsEmCqmlCBkgeUF9 dIQVMsNqeWhHrbe0Z4oins7dmkijy7lWXW86KUJPOXT/LBZjM7QlnFh8HEUptSWG+naI huG20k1rnnkuPf3bUwQMrIWqlCQGS1GcYL9/GnLPlP2KLa5rDzb+tJ0r1W/4Mx/r9tHU 9Kcw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id x78si4539999qkx.129.2018.01.31.06.16.43; Wed, 31 Jan 2018 06:16:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 57A93617B2; Wed, 31 Jan 2018 14:16:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 5BB6D617E4; Wed, 31 Jan 2018 14:03:27 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id E120F61787; Wed, 31 Jan 2018 14:03:15 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 58FF561787 for ; Wed, 31 Jan 2018 14:00:38 +0000 (UTC) Received: from mxback13g.mail.yandex.net (mxback13g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:92]) by forward102p.mail.yandex.net (Yandex) with ESMTP id CBAB743029E6 for ; Wed, 31 Jan 2018 17:00:36 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback13g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id yRtn1Jjgyz-0abqEu2X; Wed, 31 Jan 2018 17:00:36 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id Tps9JIjLUO-0aq8EGoU; Wed, 31 Jan 2018 17:00:36 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:29 +0300 Message-Id: <1517407234-19273-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> References: <1517407234-19273-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 403 Subject: [lng-odp] [PATCH API-NEXT v4 2/7] api: ipsec: IP header parameter types X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Petri Savolainen Create IP header parameter types, so that those can be used also outside of SA parameter struct. Signed-off-by: Petri Savolainen --- /** Email created from pull request 403 (psavol:next-ipsec-tfc) ** https://github.com/Linaro/odp/pull/403 ** Patch: https://github.com/Linaro/odp/pull/403.patch ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3 ** Merge commit sha: 5fe995377a907528cc4b1ce80386e5238f99e8de **/ include/odp/api/spec/ipsec.h | 72 ++++++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 32 deletions(-) diff --git a/include/odp/api/spec/ipsec.h b/include/odp/api/spec/ipsec.h index 47e3045f3..c78afbe3f 100644 --- a/include/odp/api/spec/ipsec.h +++ b/include/odp/api/spec/ipsec.h @@ -382,6 +382,44 @@ typedef struct odp_ipsec_crypto_param_t { } odp_ipsec_crypto_param_t; +/** IPv4 header parameters */ +typedef struct odp_ipsec_ipv4_param_t { + /** IPv4 source address (NETWORK ENDIAN) */ + void *src_addr; + + /** IPv4 destination address (NETWORK ENDIAN) */ + void *dst_addr; + + /** IPv4 Differentiated Services Code Point */ + uint8_t dscp; + + /** IPv4 Don't Fragment bit */ + uint8_t df; + + /** IPv4 Time To Live */ + uint8_t ttl; + +} odp_ipsec_ipv4_param_t; + +/** IPv6 header parameters */ +typedef struct odp_ipsec_ipv6_param_t { + /** IPv6 source address (NETWORK ENDIAN) */ + void *src_addr; + + /** IPv6 destination address (NETWORK ENDIAN) */ + void *dst_addr; + + /** IPv6 flow label */ + uint32_t flabel; + + /** IPv6 Differentiated Services Code Point */ + uint8_t dscp; + + /** IPv6 hop limit */ + uint8_t hlimit; + +} odp_ipsec_ipv6_param_t; + /** * IPSEC tunnel parameters * @@ -397,40 +435,10 @@ typedef struct odp_ipsec_tunnel_param_t { /** Variant mappings for tunnel parameters */ union { /** IPv4 header parameters */ - struct { - /** IPv4 source address (NETWORK ENDIAN) */ - void *src_addr; - - /** IPv4 destination address (NETWORK ENDIAN) */ - void *dst_addr; - - /** IPv4 Differentiated Services Code Point */ - uint8_t dscp; - - /** IPv4 Don't Fragment bit */ - uint8_t df; - - /** IPv4 Time To Live */ - uint8_t ttl; - } ipv4; + odp_ipsec_ipv4_param_t ipv4; /** IPv6 header parameters */ - struct { - /** IPv6 source address (NETWORK ENDIAN) */ - void *src_addr; - - /** IPv6 destination address (NETWORK ENDIAN) */ - void *dst_addr; - - /** IPv6 Differentiated Services Code Point */ - uint8_t dscp; - - /** IPv6 flow label */ - uint32_t flabel; - - /** IPv6 hop limit */ - uint8_t hlimit; - } ipv6; + odp_ipsec_ipv6_param_t ipv6; }; } odp_ipsec_tunnel_param_t; From patchwork Wed Jan 31 14:00:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126339 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp766460ljc; Wed, 31 Jan 2018 06:11:28 -0800 (PST) X-Google-Smtp-Source: AH8x226j+mo8T6DgcH3WL7ZAMXLxT3KGqnD20g86IO44QBgeF+Yc7bsITMjpWsI3f9HI/gFjmDT1 X-Received: by 10.55.191.65 with SMTP id p62mr48485907qkf.191.1517407888667; Wed, 31 Jan 2018 06:11:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517407888; cv=none; d=google.com; s=arc-20160816; b=cgvPiZsrAFtdAE7Y8hsIaIIYq4H7ptX58RdoRwOxba9ro4/4eH8LaLgJU6Fvt5YdVG qTTjAIG3BJHvl0NJKMuM7VXpQqAF/4XdlueJnN5MEbMhmkIMfV2jzXmqJPT1PBFEjY1s KxNedRXbcs4scWKQx3UA1+2xtacpDyJAkh97i1iaxKH3qVa8XGthXI57JsMufa1RnCt/ Rxm5g8Ctu6ewRH7CRwunl4fDLa7yNUkEBHgas0f/sW/q0NuC5rSOyYkXMzKpbMr6ADyM 3qrAPmBGyGfcQQAa7+oIDumdMU+5lyUVtY9qsbF/BN2irlPgDY/kfjuP9wTx9KLmedRi JPgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=FL9VFWMTtmvjfIJeAdxZKwyVXXdkTBq3ke11b+WWjaA=; b=k2TetdIHtuxpslYsUm0QY74kRJdq1J8aqdAAob2y6OfoS1HrLY2+JtbQHrwBHv16jP 4GIkyb6R/iAXa/o4ekg0dCavbcNdftv+4GQTjeQaCKuU30cdWud2iF7n2rkX9Imaorn3 5XoRjY/xxrOazFn4W0yCq/CKAVhIHnhb6VSG41WpWZ8RX+/iX9exRhE/vAyQlY0A29aW vvxntBxHr+PPhAV/tLROlKh5F8VAyVsSZ2Ii7ayglY94zuUQ3AScnOGA5evIOzJQnH24 883eKhhPX98SLkdJMIknfk0e07UYgArPhh9SMlXhtXUdJWrHEgLgIL8DZd7KmouMsRh1 kKqg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id k53si3553870qtb.144.2018.01.31.06.11.28; Wed, 31 Jan 2018 06:11:28 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 4180C617C5; Wed, 31 Jan 2018 14:11:28 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 4F27560C4C; Wed, 31 Jan 2018 14:02:49 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 67777617D7; Wed, 31 Jan 2018 14:02:41 +0000 (UTC) Received: from forward100j.mail.yandex.net (forward100j.mail.yandex.net [5.45.198.240]) by lists.linaro.org (Postfix) with ESMTPS id B08D360C4C for ; Wed, 31 Jan 2018 14:00:31 +0000 (UTC) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward100j.mail.yandex.net (Yandex) with ESMTP id A6AE85D82782 for ; Wed, 31 Jan 2018 17:00:29 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8PFjFqELQM-0TNipKRl; Wed, 31 Jan 2018 17:00:29 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LdNp02bKEL-0SEqbPNN; Wed, 31 Jan 2018 17:00:28 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:22 +0300 Message-Id: <1517407226-19192-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> References: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v4 3/7] example: instrum: use low level API to retrieve performance counters X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Use low level PAPI API to get performance counters. Exemplify on some ODP APIs. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr) ** https://github.com/Linaro/odp/pull/406 ** Patch: https://github.com/Linaro/odp/pull/406.patch ** Base sha: 079b524277414f57411d3223563353bbdbc1a536 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851 **/ example/instrum/Makefile.am | 14 +++- example/instrum/init.c | 54 +++++++++++++++ example/instrum/init.h | 19 ++++++ example/instrum/instrum.c | 19 +++++- example/instrum/instrum_common.h | 34 ++++++++++ example/instrum/papi_cnt.c | 143 +++++++++++++++++++++++++++++++++++++++ example/instrum/papi_cnt.h | 27 ++++++++ example/instrum/pktio_direct.c | 68 +++++++++++++++++++ example/instrum/pktio_direct.h | 20 ++++++ example/instrum/sample.h | 28 ++++++++ example/instrum/sched.c | 43 ++++++++++++ example/instrum/sched.h | 19 ++++++ example/instrum/store.c | 133 ++++++++++++++++++++++++++++++++++++ example/instrum/store.h | 36 ++++++++++ 14 files changed, 655 insertions(+), 2 deletions(-) create mode 100644 example/instrum/init.c create mode 100644 example/instrum/init.h create mode 100644 example/instrum/instrum_common.h create mode 100644 example/instrum/papi_cnt.c create mode 100644 example/instrum/papi_cnt.h create mode 100644 example/instrum/pktio_direct.c create mode 100644 example/instrum/pktio_direct.h create mode 100644 example/instrum/sample.h create mode 100644 example/instrum/sched.c create mode 100644 example/instrum/sched.h create mode 100644 example/instrum/store.c create mode 100644 example/instrum/store.h diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am index bf2a19c0d..42c8161bf 100644 --- a/example/instrum/Makefile.am +++ b/example/instrum/Makefile.am @@ -17,4 +17,16 @@ AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi lib_LTLIBRARIES = $(LIB)/libinstrum.la __LIB__libinstrum_la_SOURCES = \ - instrum.c + instrum.c \ + store.c \ + papi_cnt.c \ + init.c \ + pktio_direct.c\ + sched.c \ + instrum_common.h \ + sample.h \ + store.h \ + papi_cnt.h \ + init.h \ + pktio_direct.h \ + sched.h diff --git a/example/instrum/init.c b/example/instrum/init.c new file mode 100644 index 000000000..8691ff978 --- /dev/null +++ b/example/instrum/init.c @@ -0,0 +1,54 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include + +static int (*instr_odp_init_local)(odp_instance_t instance, + odp_thread_type_t thr_type); + +static int (*instr_odp_term_local)(void); + +int instr_odpinit_init(void) +{ + INSTR_FUNCTION(odp_init_local); + + if (!instr_odp_init_local) { + printf("odp_init_local: Not Found\n"); + return -1; + } + + INSTR_FUNCTION(odp_term_local); + + if (!instr_odp_term_local) { + printf("odp_term_local: Not Found\n"); + return -1; + } + + return 0; +} + +int odp_init_local(odp_instance_t instance, odp_thread_type_t thr_type) +{ + int ret; + + ret = (*instr_odp_init_local)(instance, thr_type); + + instr_store_init_local(); + + return ret; +} + +int odp_term_local(void) +{ + instr_store_term_local(); + + return (*instr_odp_term_local)(); +} diff --git a/example/instrum/init.h b/example/instrum/init.h new file mode 100644 index 000000000..b92e9d4a3 --- /dev/null +++ b/example/instrum/init.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_INIT_H__ +#define __INSTRUM_INIT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int instr_odpinit_init(void); + +#ifdef __cplusplus +} +#endif +#endif /*__INSTRUM_INIT_H__*/ diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c index 88580c58f..605675154 100644 --- a/example/instrum/instrum.c +++ b/example/instrum/instrum.c @@ -1,4 +1,4 @@ -/* Copyright (c) 2017, Linaro Limited +/* Copyright (c) 2018, Linaro Limited * All rights reserved. * * SPDX-License-Identifier: BSD-3-Clause @@ -6,13 +6,30 @@ #include #include +#include +#include +#include +#include static __attribute__((constructor)) void setup_wrappers(void) { printf("Setup Wrappers\n"); + + if (instr_store_init()) + return; + + if (instr_odpinit_init()) + return; + + if (instr_odpsched_init()) + return; + + if (instr_odppktio_direct_init()) + return; } static __attribute__((destructor)) void teardown_wrappers(void) { printf("Teardown Wrappers\n"); + instr_store_term(); } diff --git a/example/instrum/instrum_common.h b/example/instrum/instrum_common.h new file mode 100644 index 000000000..594423e1f --- /dev/null +++ b/example/instrum/instrum_common.h @@ -0,0 +1,34 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_COMMON_H__ +#define __INSTRUM_COMMON_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef RTLD_NEXT +/*#define __GNU_SOURCE*/ +#define __USE_GNU +#endif + +#include +#include + +#define INSTR_FUNCTION(func) do { \ + instr_##func = dlsym(RTLD_NEXT, #func); \ + if (dlerror()) { \ + errno = EACCES; \ + instr_##func = NULL; \ + } \ + } while (0) + +#ifdef __cplusplus +} +#endif + +#endif /* __INSTRUM_COMMON_H__ */ diff --git a/example/instrum/papi_cnt.c b/example/instrum/papi_cnt.c new file mode 100644 index 000000000..c38c856a0 --- /dev/null +++ b/example/instrum/papi_cnt.c @@ -0,0 +1,143 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include + +static int papi_event_tab[SAMPLE_COUNTER_TAB_SIZE] = {PAPI_BR_CN, PAPI_L2_DCM}; + +static __thread int event_set = PAPI_NULL; + +int papi_init(void) +{ + int retval, i; + + retval = PAPI_library_init(PAPI_VER_CURRENT); + if (retval != PAPI_VER_CURRENT) { + printf("PAPI Library initialization error!\n"); + return -1; + } + + retval = PAPI_thread_init((unsigned long(*)(void))(pthread_self)); + if (retval != PAPI_OK) { + printf("PAPI_thread_init error!\n"); + goto err_shutdown; + } + + if (PAPI_set_granularity(PAPI_GRN_THR) != PAPI_OK) { + printf("PAPI_set_granularity error!\n"); + goto err_shutdown; + } + + for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) { + retval = PAPI_query_event(papi_event_tab[i]); + if (retval != PAPI_OK) { + printf("PAPI_query_event %d - error\n", i); + goto err_shutdown; + } + } + + return 0; + +err_shutdown: + PAPI_shutdown(); + + return -1; +} + +void papi_term(void) +{ + PAPI_shutdown(); +} + +int papi_init_local(void) +{ + int retval; + + retval = PAPI_register_thread(); + if (retval != PAPI_OK) { + printf("PAPI_register_thread failed - %d\n", retval); + return -1; + } + + /* Create LL event set */ + event_set = PAPI_NULL; + retval = PAPI_create_eventset(&event_set); + if (retval != PAPI_OK) { + printf("PAPI_create_eventset error: %d\n", retval); + return -1; + } + + retval = PAPI_add_events(event_set, papi_event_tab, + SAMPLE_COUNTER_TAB_SIZE); + if (retval != PAPI_OK) { + printf("PAPI_add_events error: %d\n", retval); + goto err_clean_evset; + } + + retval = PAPI_start(event_set); + if (retval != PAPI_OK) { + printf("PAPI_start error: %d\n", retval); + goto err_clean_evset; + } + + return 0; + +err_clean_evset: + PAPI_cleanup_eventset(event_set); + PAPI_destroy_eventset(&event_set); + + return -1; +} + +int papi_term_local(void) +{ + long long last_counters[SAMPLE_COUNTER_TAB_SIZE]; + + if (PAPI_stop(event_set, last_counters) == PAPI_OK) { + int i; + + for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) + printf("Counter[%d] = %lld\n", i, last_counters[i]); + } + + PAPI_cleanup_eventset(event_set); + PAPI_destroy_eventset(&event_set); + + return 0; +} + +int papi_sample_start(profiling_sample_t *spl) +{ + spl->timestamp_ns = PAPI_get_real_nsec(); + if (PAPI_read_ts(event_set, spl->counters, &spl->diff_cyc) != PAPI_OK) { + fprintf(stderr, "PAPI_read_counters - FAILED\n"); + return -1; + } + + return 0; +} + +int papi_sample_end(profiling_sample_t *spl) +{ + long long end_counters[SAMPLE_COUNTER_TAB_SIZE], end_cyc; + int i; + + if (PAPI_read_ts(event_set, end_counters, &end_cyc) != PAPI_OK) { + fprintf(stderr, "PAPI_read_counters - FAILED\n"); + return -1; + } + + for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) + spl->counters[i] = end_counters[i] - spl->counters[i]; + + spl->diff_cyc = end_cyc - spl->diff_cyc; + + return 0; +} diff --git a/example/instrum/papi_cnt.h b/example/instrum/papi_cnt.h new file mode 100644 index 000000000..a4546c954 --- /dev/null +++ b/example/instrum/papi_cnt.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_PAPI_COUNTERS_H__ +#define __INSTRUM_PAPI_COUNTERS_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int papi_init(void); +void papi_term(void); +int papi_init_local(void); +int papi_term_local(void); + +int papi_sample_start(profiling_sample_t *spl); +int papi_sample_end(profiling_sample_t *spl); + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_PAPI_COUNTERS_H__ */ diff --git a/example/instrum/pktio_direct.c b/example/instrum/pktio_direct.c new file mode 100644 index 000000000..1cef986d5 --- /dev/null +++ b/example/instrum/pktio_direct.c @@ -0,0 +1,68 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include + +static int (*instr_odp_pktout_send)(odp_pktout_queue_t queue, + const odp_packet_t packets[], + int num); + +static int (*instr_odp_pktin_recv_tmo)(odp_pktin_queue_t queue, + odp_packet_t packets[], + int num, uint64_t wait); + +int instr_odppktio_direct_init(void) +{ + INSTR_FUNCTION(odp_pktout_send); + + if (!instr_odp_pktout_send) { + printf("odp_pktout_send: Not Found\n"); + return -1; + } + + INSTR_FUNCTION(odp_pktin_recv_tmo); + + if (!instr_odp_pktin_recv_tmo) { + printf("odp_pktin_recv_tmo: Not Found\n"); + return -1; + } + + return 0; +} + +int odp_pktout_send(odp_pktout_queue_t queue, const odp_packet_t packets[], + int num) +{ + int ret; + + STORE_SAMPLE_INIT; + + STORE_SAMPLE_START; + ret = (*instr_odp_pktout_send)(queue, packets, num); + STORE_SAMPLE_END; + + return ret; +} + +int odp_pktin_recv_tmo(odp_pktin_queue_t queue, odp_packet_t packets[], + int num, uint64_t wait) +{ + int ret; + + STORE_SAMPLE_INIT; + + STORE_SAMPLE_START; + ret = (*instr_odp_pktin_recv_tmo)(queue, packets, num, wait); + STORE_SAMPLE_END; + + return ret; +} + diff --git a/example/instrum/pktio_direct.h b/example/instrum/pktio_direct.h new file mode 100644 index 000000000..b028c3a4f --- /dev/null +++ b/example/instrum/pktio_direct.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_PKTIO_DIRECT_H__ +#define __INSTRUM_PKTIO_DIRECT_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int instr_odppktio_direct_init(void); + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_PKTIO_DIRECT_H__ */ + diff --git a/example/instrum/sample.h b/example/instrum/sample.h new file mode 100644 index 000000000..090308348 --- /dev/null +++ b/example/instrum/sample.h @@ -0,0 +1,28 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_SAMPLE_H__ +#define __INSTRUM_SAMPLE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +#define SAMPLE_NAME_SIZE_MAX 20 +#define SAMPLE_COUNTER_TAB_SIZE 2 + +typedef struct { + char name[SAMPLE_NAME_SIZE_MAX]; + long long timestamp_ns; + long long diff_cyc; + + long long counters[SAMPLE_COUNTER_TAB_SIZE]; +} profiling_sample_t; + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_SAMPLE_H__ */ diff --git a/example/instrum/sched.c b/example/instrum/sched.c new file mode 100644 index 000000000..3e4a03bf1 --- /dev/null +++ b/example/instrum/sched.c @@ -0,0 +1,43 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include + +static int (*instr_odp_schedule_multi)(odp_queue_t *from, + uint64_t wait, + odp_event_t events[], + int num); + +int instr_odpsched_init(void) +{ + INSTR_FUNCTION(odp_schedule_multi); + + if (!instr_odp_schedule_multi) { + printf("odp_schedule_multi: Not Found\n"); + return -1; + } + + return 0; +} + +int odp_schedule_multi(odp_queue_t *from, uint64_t wait, odp_event_t events[], + int num) +{ + int ret; + + STORE_SAMPLE_INIT; + + STORE_SAMPLE_START; + ret = (*instr_odp_schedule_multi)(from, wait, events, num); + STORE_SAMPLE_END; + + return ret; +} diff --git a/example/instrum/sched.h b/example/instrum/sched.h new file mode 100644 index 000000000..2a092b0ed --- /dev/null +++ b/example/instrum/sched.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_SCHED_H__ +#define __INSTRUM_SCHED_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int instr_odpsched_init(void); + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_SCHED_H__ */ diff --git a/example/instrum/store.c b/example/instrum/store.c new file mode 100644 index 000000000..77137aad8 --- /dev/null +++ b/example/instrum/store.c @@ -0,0 +1,133 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include + +#define SAMPLE_TAB_SIZE 50000 + +static __thread profiling_sample_t profile_sample_tab[SAMPLE_TAB_SIZE]; +static __thread uint64_t profile_sample_idx; +static __thread uint64_t profile_sample_ovf; + +#define STORE_DIR_ENV "ODP_INSTRUM_STORE_DIR" +#define STORE_DIR_NAME_DFLT "/tmp" +#define STORE_DIR_NAME_SIZE_MAX 250 +#define STORE_FILE_NAME_SIZE_MAX 250 + +static char store_dir[STORE_DIR_NAME_SIZE_MAX]; + +static void store_dump(int last) +{ + FILE *f = NULL; + char file_name[STORE_DIR_NAME_SIZE_MAX + STORE_FILE_NAME_SIZE_MAX]; + char smpl[250], smpl_tmp[250]; + int i, j, dump_size = SAMPLE_TAB_SIZE; + + if (last) + dump_size = profile_sample_idx; + + sprintf(file_name, "%s/profile_%d_%ju.csv", + store_dir, odp_thread_id(), + profile_sample_ovf); + + f = fopen(file_name, "w"); + if (f == NULL) { + printf("Failed to create profiling file %s\n", file_name); + return; + } + + for (i = 0; i < dump_size; i++) { + sprintf(smpl, "%lld,%lld,%s", + profile_sample_tab[i].timestamp_ns, + profile_sample_tab[i].diff_cyc, + profile_sample_tab[i].name); + for (j = 0; j < SAMPLE_COUNTER_TAB_SIZE; j++) { + sprintf(smpl_tmp, ",%lld", + profile_sample_tab[i].counters[j]); + strcat(smpl, smpl_tmp); + } + fprintf(f, "%s\n", smpl); + } + + fclose(f); +} + +int instr_store_init(void) +{ + const char *store_dir_env = NULL; + + store_dir_env = getenv(STORE_DIR_ENV); + if (!store_dir_env) + store_dir_env = STORE_DIR_NAME_DFLT; + + strncpy(store_dir, store_dir_env, STORE_DIR_NAME_SIZE_MAX); + store_dir[STORE_DIR_NAME_SIZE_MAX - 1] = '\0'; + + if (papi_init()) + return -1; + + return 0; +} + +void instr_store_term(void) +{ + papi_term(); +} + +int instr_store_init_local(void) +{ + return papi_init_local(); +} + +int instr_store_term_local(void) +{ + int ret = papi_term_local(); + + store_dump(1); + + return ret; +} + +instr_profiling_sample_t store_sample_start(const char *func) +{ + profiling_sample_t *spl = NULL; + + if (profile_sample_idx == SAMPLE_TAB_SIZE) + return NULL; + + spl = &profile_sample_tab[profile_sample_idx]; + + strncpy(spl->name, func, SAMPLE_NAME_SIZE_MAX); + spl->name[SAMPLE_NAME_SIZE_MAX - 1] = '\0'; + + if (papi_sample_start(spl)) + return NULL; + + profile_sample_idx++; + return spl; +} + +void store_sample_end(instr_profiling_sample_t _spl) +{ + profiling_sample_t *spl = _spl; + + if (!spl) /* failed sample - on start */ + return; + + if (papi_sample_end(spl)) + spl->name[0] = 0; /* failed sample - on end*/ + + if (profile_sample_idx == SAMPLE_TAB_SIZE) { + store_dump(0); + profile_sample_idx = 0; + profile_sample_ovf++; + } +} diff --git a/example/instrum/store.h b/example/instrum/store.h new file mode 100644 index 000000000..1d671fbfd --- /dev/null +++ b/example/instrum/store.h @@ -0,0 +1,36 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_STORE_H__ +#define __INSTRUM_STORE_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void *instr_profiling_sample_t; + +#define STORE_SAMPLE_INIT \ + instr_profiling_sample_t _spl + +#define STORE_SAMPLE_START \ + (_spl = store_sample_start(__func__)) + +#define STORE_SAMPLE_END \ + store_sample_end(_spl) + +int instr_store_init(void); +void instr_store_term(void); +int instr_store_init_local(void); +int instr_store_term_local(void); + +instr_profiling_sample_t store_sample_start(const char *); +void store_sample_end(instr_profiling_sample_t); + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_STORE_H__ */ From patchwork Wed Jan 31 14:00:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126340 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp767821ljc; Wed, 31 Jan 2018 06:12:59 -0800 (PST) X-Google-Smtp-Source: AH8x2246A0xVvcBEwR8v9/x9yv/LIEKN8je4c0SvuPKRxx8vve0VKRo5mg3AOyNQTnFv0rOzCmxY X-Received: by 10.200.0.89 with SMTP id i25mr36424371qtg.85.1517407979840; Wed, 31 Jan 2018 06:12:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517407979; cv=none; d=google.com; s=arc-20160816; b=WhBSkPGV5qf4HZoIrfiPRsA4K6OxWlQB4nzrdv+azrGSo3gG2vuYubhyyBALCWvswL iDD5bqX8itbXdPFZUfVfIKzkN375p6IEmQujjzUyh39jRLxPH1ZPN7qhzuNv3IdgcVTf 55XGl4Afx98Kl7Fofm6FSF0ZLafKEQ876S01Q0EP1U3yvCWny7apOthPyFvoBQMw4QD/ C+1RTAXRt6pYdOTRzfrpdQgdXH8OjtxUPORepDcATRpTYnXPBqhsBS5KQWqPQEQutTJF mBaRfaYPd1RAJLSSOHVfp9hjnM3GmIWcPQ2QXerNBveoNXTGAdiShEquH2HmsjVXOMEy GjXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=WDij437wmIEQucqjK6lZ9R+lWsEctoCCmqZKYf8H0Eg=; b=bZ7VAKSaRuZqpfs6hynX9i2lNDFftJhc8fNx/VRdzJ8qg4lUdQoi9D/ax6l2UiW7Cq fAirq+qWxQbCwFMI1gddPLZTXdOE9mNgJz817MY1opjf8Xepuz1z63BYHizAkYbd3z3D 8UYAA3ce7HP4nIV7RyASWts3fZiU9ViIQ/2UNBfWebQ4cNa14HweJTVuAF7LqqE7VUUA Bi4/kE6MfU6qS2HCGQQl5/1Xu2fbUYp7B5LuYxRBFDN9Q8EMFwyeh8uYHFAOHAYdKuDF LTvGtDS7SH+0islmeCBIgrqsLNbJfwfMe5u+cFtp3vFTH5An4tfE6VKHSQhaC/eb4q7q RyKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o1si8483680qtf.222.2018.01.31.06.12.59; Wed, 31 Jan 2018 06:12:59 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 80BF061833; Wed, 31 Jan 2018 14:12:59 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id B0730617D3; Wed, 31 Jan 2018 14:02:59 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 55818617D6; Wed, 31 Jan 2018 14:02:47 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id B0ED160C56 for ; Wed, 31 Jan 2018 14:00:31 +0000 (UTC) Received: from mxback9o.mail.yandex.net (mxback9o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::23]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 3F00556044EE for ; Wed, 31 Jan 2018 17:00:30 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback9o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id nnIAkMn1ND-0UqaXjLF; Wed, 31 Jan 2018 17:00:30 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LdNp02bKEL-0TE4RcKS; Wed, 31 Jan 2018 17:00:29 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:23 +0300 Message-Id: <1517407226-19192-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> References: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v4 4/7] example: instrum: configure papi event set X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Configure the set of papi counters to be acquired via an environment variable. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr) ** https://github.com/Linaro/odp/pull/406 ** Patch: https://github.com/Linaro/odp/pull/406.patch ** Base sha: 079b524277414f57411d3223563353bbdbc1a536 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851 **/ example/instrum/papi_cnt.c | 44 +++++++++++++++++++++++++++++++++++++++----- example/instrum/papi_cnt.h | 2 ++ example/instrum/sample.h | 2 +- example/instrum/store.c | 4 +++- 4 files changed, 45 insertions(+), 7 deletions(-) diff --git a/example/instrum/papi_cnt.c b/example/instrum/papi_cnt.c index c38c856a0..da8267834 100644 --- a/example/instrum/papi_cnt.c +++ b/example/instrum/papi_cnt.c @@ -6,17 +6,25 @@ #include #include +#include #include #include #include -static int papi_event_tab[SAMPLE_COUNTER_TAB_SIZE] = {PAPI_BR_CN, PAPI_L2_DCM}; +#define PAPI_EVENTS_ENV "ODP_INSTRUM_PAPI_EVENTS" + +#define PAPI_EVENT_TAB_SIZE_DFLT 2 +int papi_event_tab_dflt[PAPI_EVENT_TAB_SIZE_DFLT] = {PAPI_BR_CN, PAPI_L2_DCM}; + +static int papi_event_tab[SAMPLE_COUNTER_TAB_SIZE]; +static int papi_event_tab_size; static __thread int event_set = PAPI_NULL; int papi_init(void) { int retval, i; + char *papi_events_env = NULL; retval = PAPI_library_init(PAPI_VER_CURRENT); if (retval != PAPI_VER_CURRENT) { @@ -35,7 +43,28 @@ int papi_init(void) goto err_shutdown; } - for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) { + papi_events_env = getenv(PAPI_EVENTS_ENV); + if (papi_events_env) { + char *tk = strtok(papi_events_env, ","); + int papi_event; + + while (tk != NULL && + papi_event_tab_size < SAMPLE_COUNTER_TAB_SIZE) { + if (PAPI_event_name_to_code(tk, &papi_event) == PAPI_OK) + papi_event_tab[papi_event_tab_size++] = + papi_event; + + tk = strtok(NULL, ","); + } + } + + if (!papi_event_tab_size) { + for (i = 0; i < PAPI_EVENT_TAB_SIZE_DFLT; i++) + papi_event_tab[i] = papi_event_tab_dflt[i]; + papi_event_tab_size = PAPI_EVENT_TAB_SIZE_DFLT; + } + + for (i = 0; i < papi_event_tab_size; i++) { retval = PAPI_query_event(papi_event_tab[i]); if (retval != PAPI_OK) { printf("PAPI_query_event %d - error\n", i); @@ -75,7 +104,7 @@ int papi_init_local(void) } retval = PAPI_add_events(event_set, papi_event_tab, - SAMPLE_COUNTER_TAB_SIZE); + papi_event_tab_size); if (retval != PAPI_OK) { printf("PAPI_add_events error: %d\n", retval); goto err_clean_evset; @@ -103,7 +132,7 @@ int papi_term_local(void) if (PAPI_stop(event_set, last_counters) == PAPI_OK) { int i; - for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) + for (i = 0; i < papi_event_tab_size; i++) printf("Counter[%d] = %lld\n", i, last_counters[i]); } @@ -113,6 +142,11 @@ int papi_term_local(void) return 0; } +int papi_counters_cnt(void) +{ + return papi_event_tab_size; +} + int papi_sample_start(profiling_sample_t *spl) { spl->timestamp_ns = PAPI_get_real_nsec(); @@ -134,7 +168,7 @@ int papi_sample_end(profiling_sample_t *spl) return -1; } - for (i = 0; i < SAMPLE_COUNTER_TAB_SIZE; i++) + for (i = 0; i < papi_event_tab_size; i++) spl->counters[i] = end_counters[i] - spl->counters[i]; spl->diff_cyc = end_cyc - spl->diff_cyc; diff --git a/example/instrum/papi_cnt.h b/example/instrum/papi_cnt.h index a4546c954..21ffbb7ca 100644 --- a/example/instrum/papi_cnt.h +++ b/example/instrum/papi_cnt.h @@ -18,6 +18,8 @@ void papi_term(void); int papi_init_local(void); int papi_term_local(void); +int papi_counters_cnt(void); + int papi_sample_start(profiling_sample_t *spl); int papi_sample_end(profiling_sample_t *spl); diff --git a/example/instrum/sample.h b/example/instrum/sample.h index 090308348..7ed03fb9b 100644 --- a/example/instrum/sample.h +++ b/example/instrum/sample.h @@ -12,7 +12,7 @@ extern "C" { #endif #define SAMPLE_NAME_SIZE_MAX 20 -#define SAMPLE_COUNTER_TAB_SIZE 2 +#define SAMPLE_COUNTER_TAB_SIZE 10 typedef struct { char name[SAMPLE_NAME_SIZE_MAX]; diff --git a/example/instrum/store.c b/example/instrum/store.c index 77137aad8..6f7294f24 100644 --- a/example/instrum/store.c +++ b/example/instrum/store.c @@ -23,6 +23,7 @@ static __thread uint64_t profile_sample_ovf; #define STORE_FILE_NAME_SIZE_MAX 250 static char store_dir[STORE_DIR_NAME_SIZE_MAX]; +static int counters_cnt; static void store_dump(int last) { @@ -49,7 +50,7 @@ static void store_dump(int last) profile_sample_tab[i].timestamp_ns, profile_sample_tab[i].diff_cyc, profile_sample_tab[i].name); - for (j = 0; j < SAMPLE_COUNTER_TAB_SIZE; j++) { + for (j = 0; j < counters_cnt; j++) { sprintf(smpl_tmp, ",%lld", profile_sample_tab[i].counters[j]); strcat(smpl, smpl_tmp); @@ -74,6 +75,7 @@ int instr_store_init(void) if (papi_init()) return -1; + counters_cnt = papi_counters_cnt(); return 0; } From patchwork Wed Jan 31 14:00:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126351 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp778514ljc; Wed, 31 Jan 2018 06:25:05 -0800 (PST) X-Google-Smtp-Source: AH8x224EpwhI9Ag3vDq5rhVC1zC8N34fDa8Gxg7+VguDLYu6cqyPoMfojsQgHxAp+Ey6Jtxc0z0s X-Received: by 10.129.74.65 with SMTP id x62mr22830672ywa.408.1517408705149; Wed, 31 Jan 2018 06:25:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408705; cv=none; d=google.com; s=arc-20160816; b=QifVvmt4/lTM9IjiL+aEmWwfMEeLKL3bNK3KM3lOulLXLXMXqs2oqCz/4hLqdkelva ff541im/qZS3NhT3jgnI/rSp29qj0pVipOmjsntg0ibWqyHd8AbZj8+RuKMFdzjAUARz RDifGqx/0RzdShGoLcCMSTrdzsbTg9HvyaD+TKA49j3u6c97X9eNt3kwK+uYA4bG8IBP dFdwJQRhU/tLmHWgtBtvjv0dRfz/9NtUFcAb5Ad/wOJyBLj3Dl5S+NVGo5rXb1Fl65Bj SmMVpm5LH/AVcRgn2xVaJcqiKbYLB0OoUgHWvqES1Ef7zRksBw/tIHaMowhjnrFHSOj+ KvkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=KDAotvO+bihCOOcTjduPyoMEhfxmzqW3p3q5aFOatig=; b=z0Wl+W4aP3BSDdVCw0hCPGJK1KkIA0WZ6Nx1fcCxSRh2K/NrZFYIX8C21XlV11TLxu rm8hDx5vm7i8meTwE0yx4BLaxog3+F23+CxspzG8Jkc4gzzCWjv7VHmuSpzFP0YlO9KR blc5A/aFUXS1m/EYcIonk+VLlzSjCNA2C9ki29mQJFUKGGHgQ7anuNaOXeonePXMB44D TTZPp57N+zFQpcASPHKi1aVe2zNw4HoejZxjynM6i1mExq4eeTIjiWbW7wTreV3ZwF2P BJkC4q8bBRdBJI05ivQ8uJss/pbhblMXsQLeeuxgMJ3R5y/HkYwNwSrL5/sKKJc7P6vR LzJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id o23si3045944qki.233.2018.01.31.06.25.04; Wed, 31 Jan 2018 06:25:05 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id B31EA617C3; Wed, 31 Jan 2018 14:25:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 6F3DE6180B; Wed, 31 Jan 2018 14:06:55 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id 825BE60872; Wed, 31 Jan 2018 14:06:42 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 4468060872 for ; Wed, 31 Jan 2018 14:01:44 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward101o.mail.yandex.net (Yandex) with ESMTP id CCC711342BF3 for ; Wed, 31 Jan 2018 17:00:30 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id sefFmNg40P-0UdW3rpP; Wed, 31 Jan 2018 17:00:30 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LdNp02bKEL-0UEuVOxs; Wed, 31 Jan 2018 17:00:30 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:24 +0300 Message-Id: <1517407226-19192-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> References: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v4 5/7] example: instrum: configure instrumented API set X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Add configure time option to trim API set to be instrumented. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr) ** https://github.com/Linaro/odp/pull/406 ** Patch: https://github.com/Linaro/odp/pull/406.patch ** Base sha: 079b524277414f57411d3223563353bbdbc1a536 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851 **/ example/instrum/Makefile.am | 16 +++++++++++++--- example/instrum/instrum.c | 4 ++++ example/instrum/pktio_direct.h | 3 +++ example/instrum/sched.h | 3 +++ example/m4/configure.m4 | 8 ++++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am index 42c8161bf..fc4f5dcff 100644 --- a/example/instrum/Makefile.am +++ b/example/instrum/Makefile.am @@ -16,13 +16,11 @@ AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi lib_LTLIBRARIES = $(LIB)/libinstrum.la -__LIB__libinstrum_la_SOURCES = \ +INSTRUM_SRC = \ instrum.c \ store.c \ papi_cnt.c \ init.c \ - pktio_direct.c\ - sched.c \ instrum_common.h \ sample.h \ store.h \ @@ -30,3 +28,15 @@ __LIB__libinstrum_la_SOURCES = \ init.h \ pktio_direct.h \ sched.h + +if CODE_INSTRUM_SCHED +AM_CFLAGS += -DCODE_INSTRUM_SCHED +INSTRUM_SRC += sched.c +endif + +if CODE_INSTRUM_PKTIO_DIRECT +AM_CFLAGS += -DCODE_INSTRUM_PKTIO_DIRECT +INSTRUM_SRC += pktio_direct.c +endif + +__LIB__libinstrum_la_SOURCES = $(INSTRUM_SRC) diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c index 605675154..aba07e0c2 100644 --- a/example/instrum/instrum.c +++ b/example/instrum/instrum.c @@ -21,11 +21,15 @@ static __attribute__((constructor)) void setup_wrappers(void) if (instr_odpinit_init()) return; +#ifdef CODE_INSTRUM_SCHED if (instr_odpsched_init()) return; +#endif /* CODE_INSTRUM_SCHED */ +#ifdef CODE_INSTRUM_PKTIO_DIRECT if (instr_odppktio_direct_init()) return; +#endif /* CODE_INSTRUM_PKTIO_DIRECT */ } static __attribute__((destructor)) void teardown_wrappers(void) diff --git a/example/instrum/pktio_direct.h b/example/instrum/pktio_direct.h index b028c3a4f..1d30a3db0 100644 --- a/example/instrum/pktio_direct.h +++ b/example/instrum/pktio_direct.h @@ -7,6 +7,8 @@ #ifndef __INSTRUM_PKTIO_DIRECT_H__ #define __INSTRUM_PKTIO_DIRECT_H__ +#ifdef CODE_INSTRUM_PKTIO_DIRECT + #ifdef __cplusplus extern "C" { #endif @@ -16,5 +18,6 @@ int instr_odppktio_direct_init(void); #ifdef __cplusplus } #endif +#endif /* CODE_INSTRUM_PKTIO_DIRECT */ #endif /* __INSTRUM_PKTIO_DIRECT_H__ */ diff --git a/example/instrum/sched.h b/example/instrum/sched.h index 2a092b0ed..6cfc40bdc 100644 --- a/example/instrum/sched.h +++ b/example/instrum/sched.h @@ -7,6 +7,8 @@ #ifndef __INSTRUM_SCHED_H__ #define __INSTRUM_SCHED_H__ +#ifdef CODE_INSTRUM_SCHED + #ifdef __cplusplus extern "C" { #endif @@ -16,4 +18,5 @@ int instr_odpsched_init(void); #ifdef __cplusplus } #endif +#endif /* CODE_INSTRUM_SCHED */ #endif /* __INSTRUM_SCHED_H__ */ diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 5a05717b8..2d4e095c3 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -23,6 +23,14 @@ AS_HELP_STRING([--with-papi-path=DIR path to papi install directory]), AC_SUBST([PAPI_PATH]) AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ]) +AC_ARG_WITH([code-instrum-profile], +AS_HELP_STRING([--with-code-instrum-profile=all|scheduler|pktio_direct set code instrumentation profile]), + [code_instrum_profile="$withval"], + [code_instrum_profile="all"]) + +AM_CONDITIONAL([CODE_INSTRUM_SCHED],[test $code_instrum_profile = "all" || test $code_instrum_profile = "scheduler"]) +AM_CONDITIONAL([CODE_INSTRUM_PKTIO_DIRECT],[test $code_instrum_profile = "all" || test $code_instrum_profile = "pktio_direct"]) + AC_CONFIG_FILES([example/classifier/Makefile example/generator/Makefile example/hello/Makefile From patchwork Wed Jan 31 14:00:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126355 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp780967ljc; Wed, 31 Jan 2018 06:28:13 -0800 (PST) X-Google-Smtp-Source: AH8x2248V8D9Du6vi6bjVXvGt6Ct4cowi8hwUuuZk3c0cqVNlHB6oXdpwbA4flOjpXeJzy8pA6UB X-Received: by 10.13.237.69 with SMTP id w66mr22886765ywe.313.1517408892873; Wed, 31 Jan 2018 06:28:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408892; cv=none; d=google.com; s=arc-20160816; b=1Ka5tOiPkahn/s394GMV2ps1tW1BNJWAJ5WF/I6MYO9t/JCy7YHDtOCf0QzWKh80qX 1Vlm73NnJMgxbASrEOX9wX+UNHlWDvweq0+wybM39KSVMZpa3lBj9uYkiSAAnhQW1pjd RajiWrJ3e0nLC7znZKp6TfvLapFpEGF71u1lPKSR3HG+p/u7FWc4bVwfF/V6q7zvDcrN wd87Gv25/qR6ZoCl5amOAVK09ZyAzztagKVGMqO2mWFxHY3evJra/f/Ic60axYaFsfoT PJREgl/FFSZdVlOqtByqUb00j9mAsnu6C/mM4ESGDb6j3snJrwCqDbxAIHznjd1hY8K6 7N1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=tqCcLQYt2Z0MgBxZ8u4gj0aO6md4efnE5Ug/L3ofKlI=; b=ZR5KsASvf/DhAKCFDdgvltHBd5QVF6YDSMS7NTo0/1YwNuymSkDUXKMMOPE1pdHZFI Sodlqv6U3IgCb2q9gT8mpZ1zZMZkX5KuzdpWODUCkJREEp5aHQN5p6dz9WXN81JL0+HU RVmRWKdVNrKBFBJEescZaEK/NJ30lcZPp67LSrDVWfMbJO9vTMoLdi+FZXF519vl6lRk BrJ9HGcqWxG7G955moFJcgu2vA0XNCHC7jYodSGMUdmLd5S30Yxj39fh6zwGiInKpBwm rtlPvDQtaM1VAty26aCoCbmaMRpWtlL0l6TrVpJb9RcK1bYxjBUC19gi7kItC9gxgYuo +z0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id n24si2912999qtf.477.2018.01.31.06.28.12; Wed, 31 Jan 2018 06:28:12 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 86D37617A1; Wed, 31 Jan 2018 14:28:12 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id DFD8961818; Wed, 31 Jan 2018 14:07:55 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id EDFDE61817; Wed, 31 Jan 2018 14:07:45 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 95EFB609D9 for ; Wed, 31 Jan 2018 14:02:07 +0000 (UTC) Received: from mxback9j.mail.yandex.net (mxback9j.mail.yandex.net [IPv6:2a02:6b8:0:1619::112]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 602D44445074 for ; Wed, 31 Jan 2018 17:00:31 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback9j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hD0YfZw8iV-0VI82Vog; Wed, 31 Jan 2018 17:00:31 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LdNp02bKEL-0UEWuuCt; Wed, 31 Jan 2018 17:00:30 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:25 +0300 Message-Id: <1517407226-19192-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> References: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v4 6/7] example: instrum: update DEPENDENCIES X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Describe configuration and requirements of code instrumentation library. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr) ** https://github.com/Linaro/odp/pull/406 ** Patch: https://github.com/Linaro/odp/pull/406.patch ** Base sha: 079b524277414f57411d3223563353bbdbc1a536 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851 **/ DEPENDENCIES | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/DEPENDENCIES b/DEPENDENCIES index 008c4df4d..898132cdc 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -202,6 +202,88 @@ Prerequisites for building the OpenDataPlane (ODP) API 1024MB of memory: $ sudo ODP_PKTIO_DPDK_PARAMS="-m 1024" ./test/performance/odp_l2fwd -i 0 -c 1 +3.5 Code instrumentation with PAPI library (optional) + + PAPI library is used to instrument ODP API. + +3.5.1 Building PAPI library + + ODP example library 'instrum' is using PAPI library to retrieve performance + counters associated with execution of ODP API. PAPI library is currently at 5.6.0. + However, if possible one should try to use the latest PAPI master branch commit for + the best performance and the latest bug fixes. + + # Checkout PAPI code + $ git clone https://bitbucket.org/icl/papi.git + $ cd papi + $ git checkout papi-5-6-0-t (optional) + + # Build PAPI + $ cd ./src/ + $ ./configure --prefix= + $ make clean + $ make + $ make install + + Alternatively, one may install PAPI from packages, if available. + # apt-get install libpapi-dev + +3.5.2 Building ODP with PAPI support + + $ cd + $ ./bootstrap + $ ./configure --enable-code-instrum --with-papi-path= + $ make clean + $ make + + Note 1: Specifying PAPI install path (with '--with-papi-path' option) is not required if + PAPI was installed from packages. + Note 2: Building ODP with PAPI support forces dynamic linkage of ODP example applications with + ODP library. + +3.5.3 Configuration of instrumented API set + + Instrumentation profile option can be applied at configure time to select API set to + be instrumented. By default, all ODP APIs stated in 'instrum' example are instrumented. + + $ ./configure --with-papi-path= --with-code-instrum-profile= + +3.5.4 Running ODP application with code instrumentation + + ODP example library 'instrum' is preloaded before execution of ODP application. ODP application + must link dynamically with ODP library. + + # LD_PRELOAD=libinstrum.so.0.0.0 ./odp_application + + Note: ODP and PAPI shared libraries must be accessible at runtime. Use LD_LIBRARY_PATH for + non-standard locations. + + # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/lib:/lib + +3.5.5 Retrieving performance counters + + Performance counters are acquired per ODP worker and dumped in fix size sample chunks to CSV files. + + CSV file name is composed as follows: profile__.csv + + Default CSV files storage folder is '/tmp'. Use ODP_INSTRUM_STORE_DIR environment variable to + select a different folder. + + # export ODP_INSTRUM_STORE_DIR= + + CSV row contains the counters for execution of one API call: timestamp (ns) for the start of API call, + duration (cycles), API name and the differences between end and start for the list of PAPI counters. + +3.5.6 Selecting performance counters + + By default, PAPI_BR_CN and PAPI_L2_DCM are acquired. Use ODP_INSTRUM_PAPI_EVENTS environment variable + to configure the list of PAPI counters (events). + + # export ODP_INSTRUM_PAPI_EVENTS=PAPI_BR_CN,PAPI_L2_DCM,PAPI_BR_UCN + + Note: Some PAPI counters may not be available for some architectures. Use papi tools 'papi_avail' and + 'papi_native_avail' to retrieve the list of available counters. + 4.0 Packages needed to build API tests CUnit test framework version 2.1-3 is required From patchwork Wed Jan 31 14:00:26 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Github ODP bot X-Patchwork-Id: 126341 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp768601ljc; Wed, 31 Jan 2018 06:13:54 -0800 (PST) X-Google-Smtp-Source: AH8x224emm6T9iQyH8+6vtZOxMqjbCasE4usJisCc6yKjEZMnEqIzkhZPdq9VPG+B6QcsQotIGdA X-Received: by 10.200.42.18 with SMTP id k18mr53973246qtk.150.1517408033823; Wed, 31 Jan 2018 06:13:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517408033; cv=none; d=google.com; s=arc-20160816; b=DfkUrjA16xecfnekRLuHShZkuO3dh6fs8swUCag5v5tTRbncEbVC7Nbp+laojZK4NY nSRGb0eTlqp7w7V/QLKcEARAfzZGaxLyQ2npi2IKdaaQCtSIV9j5n3N2ciHC3dy+09+Y JSQ5HZseyAcN/G/5Ck3bapHzP7kn/NC52cnMd6RKHrPA7L+r8O1Oo+mGNxTbc3Tkbk7T objhIO8tBg2M0bwp074ZFJ0xfg6PTbusJq1DyYBIemdmwcMuUF1GehlcEZR+cT+Jiij1 oC83/7K12sqzCcus/HCZbPRRjd2aLlGoKX/gRpW6DNhz+/SORQOLKEPPpreCN69k3oa3 Fstw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:github-pr-num :references:in-reply-to:message-id:date:to:from:delivered-to :arc-authentication-results; bh=Bwd8VA2C51BnpNto43RJ4k1eF9zwQArTevmz4D8foO0=; b=KSPopVzVrMqzgQEvxaexdoMykjh6dO3vZtyrym6VbiiP2yAIjjDO86U8lD98NgItg5 QcYVkpDs/YWlzq8LV922YKYVwlMyL4v5u2FMZaJH/h8DUchxzgdrlXv8jM+Ga2ltXvjv BPb+wm71MTXx9HcLMXxUpgcm7xNz9JsyNwTRzRDxDumR1/mIkY15iKYQaI0Mj69BAxJ+ YyGMF2gfWJZFPcQkOdG0EOGxmwVu8+rSI0ByjjdQZGnXW6dktJc+ZzuGAGxgpzZ82I7F QlLIUr9/m84HtdMD+SPJu9Ds4DPgKOcoXvmQf1pGdB/I02ySmobJFU1Fid7skRD8pmR4 BxCA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Return-Path: Received: from lists.linaro.org (ec2-54-197-127-237.compute-1.amazonaws.com. [54.197.127.237]) by mx.google.com with ESMTP id 62si2287382qke.446.2018.01.31.06.13.53; Wed, 31 Jan 2018 06:13:53 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 72050617C0; Wed, 31 Jan 2018 14:13:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id 0D61E617D9; Wed, 31 Jan 2018 14:03:12 +0000 (UTC) X-Original-To: lng-odp@lists.linaro.org Delivered-To: lng-odp@lists.linaro.org Received: by lists.linaro.org (Postfix, from userid 109) id C2A9D617D4; Wed, 31 Jan 2018 14:02:53 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id 576F461502 for ; Wed, 31 Jan 2018 14:00:33 +0000 (UTC) Received: from mxback10j.mail.yandex.net (mxback10j.mail.yandex.net [IPv6:2a02:6b8:0:1619::113]) by forward104j.mail.yandex.net (Yandex) with ESMTP id F044F429BA for ; Wed, 31 Jan 2018 17:00:31 +0300 (MSK) Received: from smtp3o.mail.yandex.net (smtp3o.mail.yandex.net [2a02:6b8:0:1a2d::27]) by mxback10j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id GGy2qAZv2J-0VSGXhpk; Wed, 31 Jan 2018 17:00:31 +0300 Received: by smtp3o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id LdNp02bKEL-0VEqOmEb; Wed, 31 Jan 2018 17:00:31 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Wed, 31 Jan 2018 17:00:26 +0300 Message-Id: <1517407226-19192-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> References: <1517407226-19192-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v4 7/7] example: instrum: add travis test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Add test to validate ODP build with papi library. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 406 (bogdanPricope:cat_benchmark_pr) ** https://github.com/Linaro/odp/pull/406 ** Patch: https://github.com/Linaro/odp/pull/406.patch ** Base sha: 079b524277414f57411d3223563353bbdbc1a536 ** Merge commit sha: c25517810ea3389a28c0adb2fdde601eae684851 **/ .travis.yml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/.travis.yml b/.travis.yml index f5a67781e..f4ed4736d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -205,6 +205,16 @@ install: fi sudo insmod ./netmap/LINUX/netmap.ko fi +# PAPI library + - | + if [ -z "$CROSS_ARCH" -a ! -f "$HOME/papi-install/lib/libpapi.so" ]; then + git -c advice.detachedHead=false clone -q --depth=1 --single-branch --branch=papi-5-6-0-t https://bitbucket.org/icl/papi.git + pushd papi/src + ./configure --prefix=$HOME/papi-install + make + make install + popd + fi script: - if [ -z "$CROSS_ARCH" ] ; then @@ -307,6 +317,17 @@ jobs: - ./configure --with-platform=linux-dpdk --enable-test-cpp --enable-test-vald --enable-test-helper --enable-test-perf --enable-user-guides --enable-test-perf-proc --enable-test-example --with-sdk-install-path=`pwd`/dpdk-17.02/${TARGET} --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH $CONF - make -j $(nproc) - sudo LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" make check + - stage: test + env: TEST=code_instrum + compiler: gcc + script: + - ./bootstrap + - ./configure --prefix=$HOME/odp-papi-install --enable-test-cpp --enable-test-vald --enable-test-helper --enable-test-perf --enable-user-guides --enable-test-perf-proc --enable-test-example --with-cunit-path=$HOME/cunit-install/$CROSS_ARCH --with-papi-path=$HOME/papi-install $CONF + - make -j $(nproc) + - make install + - sudo $HOME/papi-install/bin/papi_avail + - mkdir $HOME/store + - sudo LD_LIBRARY_PATH="/usr/local/lib:$HOME/odp-papi-install/lib:$HOME/papi-install/lib:$LD_LIBRARY_PATH" ODP_INSTRUM_STORE_DIR=$HOME/store LD_PRELOAD=libinstrum.so.0.0.0 $HOME/odp-papi-install/bin/odp_generator -I lo --srcmac a0:36:9f:28:e2:57 --dstmac 00:0f:fe:c5:73:66 --srcip 192.168.150.1 --dstip 192.168.150.2 -m u -n 200 after_failure: - cat config.log - find . -name "*.trs" | xargs grep -l '^.test-result. FAIL' | while read trs ; do echo FAILURE detected at $trs; cat ${trs%%.trs}.log ; done