From patchwork Mon Feb 5 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: 126895 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2003174ljc; Mon, 5 Feb 2018 06:08:56 -0800 (PST) X-Google-Smtp-Source: AH8x224f+mrcln+K+QzXcwOWKRlZDCNEbVQRChZOE1GJ6Ug6XD1YhnKhlQOm88GnKPKIctnRKuJP X-Received: by 10.55.140.130 with SMTP id o124mr69541530qkd.120.1517839736613; Mon, 05 Feb 2018 06:08:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839736; cv=none; d=google.com; s=arc-20160816; b=tEcRDARkYjpgkBptCW6Bsjy05vOfAd4uKntsRaYzEDgIFh4/sGuY1Q5sD7QtuW7Q9X rS7x+jgLWlEMfBNwv/SxqafSCVU1YWSeZHddw9ZAtSwExDOh+9b8do1Xc01O/i8bDnuI MtVniHEepjE3NTNBwAcXFxqrJ8VHSlhc94wxlNvOh4PpMwjxpBzOJCsLoGy82TivHzqH 3OMN5UaiY5gaIxf3+m3+a685NGVMajJfC/MTXPOzCb36JnqCCry3ITD2aZP5Y6+yhV++ b3ce80NApHF3VRrx1rpX4A/CjMNdnBrSeR2uELCVgBxrbrAV74DZ0ajaBYecfxFhJeaP ObpA== 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=/ntaEfTC3F7eOaOu4pD2Bnrdo0I4oWwTI1gf0Qd8axM=; b=Pqi55/xqzftS98rVvJJpZRZS5+Fq4Exoreww0DfmaryDsDhCtvu+fYx5SFYVLiWKqA spv2ieVqeMX3ln52daPSiIREgKNUhmoEIk+slbMBtaFzhryUBBLrrALVWqHH3xZ6v3JN pM25plsUS0m8PyhlVNMwnpF8hvnDSKcYYr4IytuwSs9Y9u3K2fwKAWx7gClciPMNXin2 Lik7rio8QHpFrtHenq44iseyRovmlt+CP5ZNUP6C3jS3Z7+RbY3UWuOBDiVCoiu9Fesi +uqwlMPFGaOR/Y5xIBMa9F4g/5nG8odSEHhDGpdF70s1jSRabZLie6rEKtOAgufCdC2Z z84g== 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 k16si1258609qtf.130.2018.02.05.06.08.56; Mon, 05 Feb 2018 06:08:56 -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 3953061833; Mon, 5 Feb 2018 14:08:56 +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 E2C4D617FF; Mon, 5 Feb 2018 14:02:45 +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 2AA7D61787; Mon, 5 Feb 2018 14:01:55 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id 5281361762 for ; Mon, 5 Feb 2018 14:00:38 +0000 (UTC) Received: from mxback7o.mail.yandex.net (mxback7o.mail.yandex.net [IPv6:2a02:6b8:0:1a2d::21]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 8890A4301EF5 for ; Mon, 5 Feb 2018 17:00:31 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback7o.mail.yandex.net (nwsmtp/Yandex) with ESMTP id tpD0chqSTa-0VcuOoZ1; Mon, 05 Feb 2018 17:00:31 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0U2OeVua; Mon, 05 Feb 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: Mon, 5 Feb 2018 17:00:22 +0300 Message-Id: <1517839228-10374-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 1/7] example: add basic papi configuration option 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 configuration options to enable code instrumentation. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ configure.ac | 1 + example/m4/configure.m4 | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/configure.ac b/configure.ac index 7b90b2127..6e9edc372 100644 --- a/configure.ac +++ b/configure.ac @@ -410,4 +410,5 @@ AC_MSG_RESULT([ test_helper: ${test_helper} test_example: ${test_example} user_guides: ${user_guides} + code instrumentation: ${code_instrumentation} ]) diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 1ce0cb11d..2fcf596ca 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -7,6 +7,16 @@ AC_ARG_ENABLE([test-example], [test_example=yes]) AM_CONDITIONAL([test_example], [test x$test_example = xyes ]) +code_instrumentation=no +AC_ARG_ENABLE([code-instrum], + [AS_HELP_STRING([--enable-code-instrum], [enable code instrumentation support])], + [if test x$enableval = xyes; then + code_instrumentation=yes + PKG_CHECK_MODULES([PAPI], [papi-5]) + fi]) + +AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ]) + AC_CONFIG_FILES([example/classifier/Makefile example/generator/Makefile example/hello/Makefile From patchwork Mon Feb 5 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: 126889 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1996565ljc; Mon, 5 Feb 2018 06:02:04 -0800 (PST) X-Google-Smtp-Source: AH8x2275SwL5PeaCGpqWQzf+hSnetuPlobAJE+4eofJ5wg6qA+/uG4DI2cCqOrr1Cu8ivZwRFG0j X-Received: by 10.55.65.20 with SMTP id o20mr65960450qka.270.1517839324727; Mon, 05 Feb 2018 06:02:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839324; cv=none; d=google.com; s=arc-20160816; b=JIe1t/ZI4mO6a1EmmD108VkndpHR3rhdwDYuoQY0gEJiwugck2jle9PlRb2BN4bzVt 4lkDMAXKgGtrN10YxyD054HgQpQbW3F35J9AVugO2DDN/W6V1shdl0hY1L4/YiTnZ5/+ Gre8l716Jo8/zsSfYfkSoQWrjSknGsttXEp+sXwCe4NWTZbRX49F0QB09sO2Y3jA96kb jF6x5Fhx1rWia4s+02J5JTVv+Nq/in2/7tncxRZtJVhBCjEAU07r0LB4YHf19rdP93mY Lm0hziBJvYnTymg7Ynde3YvFnH7gJN75PiDzT9N/krzECHvldFTcDNm5jXkDxiAaBY6J EFRQ== 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=9i6kzY/W1G3AXDY4PO6VP34+xyj5NR0/mDZJH+NGbvo=; b=noSlJU1fl3EYgvXENpdeEZT7YrtVTxSdHNpCyJcjFlvo/dNMA9oqA3olb9cRW36k/6 +ULCxmQ0uvu8nyh0lgDYqmbCsb8x75NszNUiPB4nfhnzNehpF0SC5U7ENxY3o6509GZt ybNHMgtw7dahFHAi99af5zUSOPdgLqVBd5vcV+4peldiWkfDuIuBQ4YUz0FGCdQMq1SN EzFIy8EcN5kWeYfRA/ojNM9/wycR1Vy0xRD7+kU/Ssa7KOSR5DTVeansslckvxjLVoeK sx/d9zMPM2ocDzQdJeVOe90nS1GrjR4pPyqYrKuTzF24jDC5ivCePB3vBLN2x3EuQoZh s7JA== 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 130si3457038qkd.347.2018.02.05.06.02.04; Mon, 05 Feb 2018 06:02:04 -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 5ACBA61762; Mon, 5 Feb 2018 14:02: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_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 B2EBE60CA0; Mon, 5 Feb 2018 14:01:46 +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 BE2156177D; Mon, 5 Feb 2018 14:01:41 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 37C7160674 for ; Mon, 5 Feb 2018 14:00:33 +0000 (UTC) Received: from mxback14j.mail.yandex.net (mxback14j.mail.yandex.net [IPv6:2a02:6b8:0:1619::90]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 2A72A783B09 for ; Mon, 5 Feb 2018 17:00:32 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback14j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id sADE7aujFy-0VaGIPZK; Mon, 05 Feb 2018 17:00:32 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0V2CLILg; Mon, 05 Feb 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: Mon, 5 Feb 2018 17:00:23 +0300 Message-Id: <1517839228-10374-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 2/7] example: instrum: add skeleton 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 instrumentation library as odp example. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ example/Makefile.am | 4 ++++ example/Makefile.inc | 4 ++++ example/instrum/Makefile.am | 15 +++++++++++++++ example/instrum/instrum.c | 18 ++++++++++++++++++ example/m4/configure.m4 | 1 + 5 files changed, 42 insertions(+) create mode 100644 example/instrum/Makefile.am create mode 100644 example/instrum/instrum.c diff --git a/example/Makefile.am b/example/Makefile.am index 2ea244cf7..332dbae46 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -13,4 +13,8 @@ SUBDIRS = classifier \ timer \ traffic_mgmt +if CODE_INSTRUM +SUBDIRS += instrum +endif + noinst_HEADERS = example_debug.h diff --git a/example/Makefile.inc b/example/Makefile.inc index 3c8060da9..6d62cb6ab 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -16,7 +16,11 @@ AM_CFLAGS = \ $(HELPER_INCLUDES) if STATIC_APPS +if !CODE_INSTRUM AM_LDFLAGS = -L$(LIB) -static else AM_LDFLAGS = endif +else +AM_LDFLAGS = +endif diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am new file mode 100644 index 000000000..ff4a04060 --- /dev/null +++ b/example/instrum/Makefile.am @@ -0,0 +1,15 @@ +include $(top_srcdir)/Makefile.inc + +AM_CFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/example \ + $(ODP_INCLUDES) \ + $(HELPER_INCLUDES) \ + $(PAPI_CFLAGS) + +AM_LDFLAGS = $(PAPI_LIBS) + +lib_LTLIBRARIES = $(LIB)/libinstrum.la + +__LIB__libinstrum_la_SOURCES = \ + instrum.c diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c new file mode 100644 index 000000000..88580c58f --- /dev/null +++ b/example/instrum/instrum.c @@ -0,0 +1,18 @@ +/* Copyright (c) 2017, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include + +static __attribute__((constructor)) void setup_wrappers(void) +{ + printf("Setup Wrappers\n"); +} + +static __attribute__((destructor)) void teardown_wrappers(void) +{ + printf("Teardown Wrappers\n"); +} diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 2fcf596ca..d925bbe78 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -31,4 +31,5 @@ AC_CONFIG_FILES([example/classifier/Makefile example/time/Makefile example/timer/Makefile example/traffic_mgmt/Makefile + example/instrum/Makefile example/Makefile]) From patchwork Mon Feb 5 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: 126890 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1997676ljc; Mon, 5 Feb 2018 06:03:06 -0800 (PST) X-Google-Smtp-Source: AH8x226YVN6GDfhI/5eJfUXZao9q+r12HAyyNUELRwmZVhBv65UMYcwcj2LBCraPvbdR6potBYce X-Received: by 10.55.170.150 with SMTP id t144mr39072204qke.339.1517839386584; Mon, 05 Feb 2018 06:03:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839386; cv=none; d=google.com; s=arc-20160816; b=wB6tu/wE2dpm4naEkirRn/H0A10wuVoHwW6Y4w3948dKtxZLWu/b2eG7LVFIb6m+W2 EJq7EQF9mespQETRbRGXDivxiNQdfiO/zMEWmTU2xkMKsI5Tir5Igrlga/Mv3X4chRzQ vlEtQ1tsTiAMHiG0F39hr+4v/xNjqz4M15B8cKY3OX+wu0JlzqCjLp5NMwrP0pSDWLv5 caeIWTcw+91Os7iOFsXaIEDw5CcVBckybC/yghpuoKswTM7OeelhtWluy5Zz5wqYuY0T a4XE7OBcmqa/CpGWxapffU6FFlluhneCP6JOUZZhECKYyX3h3m8oFO3LizkV/cIFVBLd 9P9g== 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=9hCZAdX8JBuUA0T2Ko8DJuMfL8DRrA7Cgdwtbni3vy8=; b=vjKQRN3M2VeeZbXBXICuE6s1pnM8xXOIIwRvSoOlubD72iNbAatxvsGzM5AKlGibDB Owg7F3wVteufTnnXtnB2sLKYPf6KpCJtQp1yxGc/blkmjlvkA7Xq8Hp0MxB6yc+tWWbu +fNEOo/f0hWWXagAjoqDYNPzbrVKO1TjCpEn55NY5J0XmbK0tk3+wjWwCtXO0YfrdY9U 5JkFsei8R2vk6BOkeHvd65BfmHrkHkoRBt2gZzlJ9mBU8V1ATCiTRI3OQQNVhMewr69R qdNFnJyBcH8/QBIFvf7kCVHdmEikC4JTCSS3AW8cNmx/gSapU55lcwHXQueoWgyOuoQC NNrQ== 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 i74si94564qki.250.2018.02.05.06.03.06; Mon, 05 Feb 2018 06:03:06 -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 1EC736181B; Mon, 5 Feb 2018 14:03:06 +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 00C9460975; Mon, 5 Feb 2018 14:02:03 +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 3F60D60975; Mon, 5 Feb 2018 14:01:44 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id AFD1660CA0 for ; Mon, 5 Feb 2018 14:00:34 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward106o.mail.yandex.net (Yandex) with ESMTP id 98708783D1C for ; Mon, 5 Feb 2018 17:00:33 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id t5w7hXBBkk-0Xbm0CDL; Mon, 05 Feb 2018 17:00:33 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0W2mDO63; Mon, 05 Feb 2018 17:00:32 +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: Mon, 5 Feb 2018 17:00:24 +0300 Message-Id: <1517839228-10374-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 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 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ 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 | 67 ++++++++++++++++++ example/instrum/pktio_direct.h | 19 ++++++ example/instrum/sample.h | 28 ++++++++ example/instrum/sched.c | 43 ++++++++++++ example/instrum/sched.h | 19 ++++++ example/instrum/store.c | 134 ++++++++++++++++++++++++++++++++++++ example/instrum/store.h | 36 ++++++++++ 14 files changed, 654 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 ff4a04060..852bdc77f 100644 --- a/example/instrum/Makefile.am +++ b/example/instrum/Makefile.am @@ -12,4 +12,16 @@ AM_LDFLAGS = $(PAPI_LIBS) 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..79cda85ac --- /dev/null +++ b/example/instrum/pktio_direct.c @@ -0,0 +1,67 @@ +/* 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..1bc544dd2 --- /dev/null +++ b/example/instrum/pktio_direct.h @@ -0,0 +1,19 @@ +/* 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..fd9cc512c --- /dev/null +++ b/example/instrum/store.c @@ -0,0 +1,134 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#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 Mon Feb 5 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: 126891 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2000139ljc; Mon, 5 Feb 2018 06:05:41 -0800 (PST) X-Google-Smtp-Source: AH8x225X5apClTAfpXBUk/pipnclPVWKTN0uRzcTJEpTzf4KoV4iZACaqcnjeIUoDNERCTujYMZV X-Received: by 10.55.204.132 with SMTP id n4mr15782275qkl.172.1517839541047; Mon, 05 Feb 2018 06:05:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839541; cv=none; d=google.com; s=arc-20160816; b=zdfg8ST/CqkfWqaUxFNdKJVvJ1ku50Vu90ep/2ahr4N3z+h/axzmnKQ8tzPwHg8v9d hKtjVhXAIDrrKKQPvC5XfMoztaSsHqBccZZTZrnzKf89QxZ/g+VOm+IbYzlFjQmVaqVD +8P+nKk8KC3sJc5adlxfN0GbQmcEAh8ldhnho3z7ZPXDL6EdwNVk9jS34EWnCX8SFLxv wIuTIZD02V9dH+1LyvgOlcco4SUP5CAE+JHiWqSRCw+zjVYLh5wKvJkqsPDHhm5Q+eI2 nKTJIxiezi5T72QrRe+f2OBMaMhaq86njSrpm7XP5U88WORXydFF/ID8bdkuYHs/p6qG dZdA== 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=i7IDj7w06HNodpPZQLWNMoVSGnmciR3L+2Of8UgGBk4=; b=mgNRXfAgjsL2dRVLHcgOSCWYENTEq5SYZfGBhnImwxUkBEkUwU+oEJi+9Ep6szgLNP 5X2MpsXzj32h0JbwiaBEvksLMZrVP0HBF/sFzAh4vz0ara16KSlxri9TnChr2R5wauUC bIEslEqc9dVAwoi1oeP8aHBWpL8zS/Tc9jd55CNO9ZzManucOU6czmCcGyxq0QVb/CR6 Um4s3N/L25ZkMC3GMRv4sJNtIo+TY0hjWfc0Vr+9mg6IutOA+eBccCn5aAVJL3oNVDCX YRdq37KA8VIkRofnZqehwlmAZGmbx0L+sg8wADMg7Jj4tl3d1zevX+dVuCHl2ri8CrTY YANA== 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 m8si2785692qte.189.2018.02.05.06.05.40; Mon, 05 Feb 2018 06:05:40 -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 8710561760; Mon, 5 Feb 2018 14:05: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_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 AD89E617D8; Mon, 5 Feb 2018 14:02:18 +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 9A65F6151E; Mon, 5 Feb 2018 14:01:49 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 5C6CD6151E for ; Mon, 5 Feb 2018 14:00:36 +0000 (UTC) Received: from mxback13j.mail.yandex.net (mxback13j.mail.yandex.net [IPv6:2a02:6b8:0:1619::88]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 6C12C2D8487E for ; Mon, 5 Feb 2018 17:00:34 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback13j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id CLqkqHqYwK-0Ybmfmbp; Mon, 05 Feb 2018 17:00:34 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0X2mJoal; Mon, 05 Feb 2018 17:00:33 +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: Mon, 5 Feb 2018 17:00:25 +0300 Message-Id: <1517839228-10374-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 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 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ 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 fd9cc512c..98fb1f445 100644 --- a/example/instrum/store.c +++ b/example/instrum/store.c @@ -24,6 +24,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) { @@ -50,7 +51,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); @@ -75,6 +76,7 @@ int instr_store_init(void) if (papi_init()) return -1; + counters_cnt = papi_counters_cnt(); return 0; } From patchwork Mon Feb 5 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: 126894 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2002452ljc; Mon, 5 Feb 2018 06:08:12 -0800 (PST) X-Google-Smtp-Source: AH8x224vHrKWO08XBMXs9BHLwSsROy0Czy0JkkxnHmC37+r9Ue0KjsrzOj34f6HZPPAze00spui8 X-Received: by 10.237.55.70 with SMTP id i64mr74567472qtb.224.1517839692642; Mon, 05 Feb 2018 06:08:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839692; cv=none; d=google.com; s=arc-20160816; b=aVjFbm8KzhYYne5nWhb/bs0BjPCJr7m7UABJCnAsIy4VkCa4AxI9JJiue6nyVVA9iO W39AmU4ERl0JcPvtA+XSRSlIx16EBC0rb4IrKakME/V5GZynQw9FuS0dPcQ02nRDwlOK +cvBJNY0pyrV2AkR3ljWQ2zoRb4m9ViW96Pbh9KkU4O85wNi5DtLckhJ9RQ5CI7A3uGI VJ6/yjxms7bRmo5jyfNXFdUNgFmkfnPQZaBCVLswqhvq43qpSXemea/t+wR2Afm7cBEJ EyAAssXHfepYvPgg7MafkqqK4qhve1hGIbsZr7p189N8KBp06Meh/nIZAD1yfwWO6BVB qASg== 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=EHWwkt/Hf/+mD107GaVBq7GyW+R8vOMKM5FfixhFwXM=; b=Rb8gU9yadYU3nhbjsBloI9ufDwPE7S7mLGmPLXp+hcIWp+QtHxAe3oC2ypTRUbLpZJ 2Ghny5wWBw4vC+THlKIYpy4wTpwXKz+im2KLQYbubBqF5Q+3oRUfsdwa41A9pHJO+cG3 czydUnXtcsxlboHnlJ7GAKNRiJXArVQ9hGl4xFUg6Jj1UlyT6FlHBZpMmsULNF/BAQQl 2efKJk9C4jcn0IXdaDALM/gzmRAbwSLF4X23ZexXFDgLHwy+y3LwpZtF0sShJpo7WHD7 tTvJtHw8e2Z6WSLqGP+YD7V5C3X2xlKAp/HCSegfuTxx8P0VxfeI6mp4hBoGzz4RxKQ/ BZAQ== 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 h21si2843923qtb.257.2018.02.05.06.08.12; Mon, 05 Feb 2018 06:08: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 41FA06181B; Mon, 5 Feb 2018 14:08: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 A26A0617F8; Mon, 5 Feb 2018 14:02:40 +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 7ACE661791; Mon, 5 Feb 2018 14:01:54 +0000 (UTC) Received: from forward101j.mail.yandex.net (forward101j.mail.yandex.net [5.45.198.241]) by lists.linaro.org (Postfix) with ESMTPS id 7EDDB6171D for ; Mon, 5 Feb 2018 14:00:36 +0000 (UTC) Received: from mxback10g.mail.yandex.net (mxback10g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:171]) by forward101j.mail.yandex.net (Yandex) with ESMTP id 398F4124133E for ; Mon, 5 Feb 2018 17:00:35 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback10g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hX9wSnzOXq-0ZpagUIj; Mon, 05 Feb 2018 17:00:35 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0Y209TBC; Mon, 05 Feb 2018 17:00:34 +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: Mon, 5 Feb 2018 17:00:26 +0300 Message-Id: <1517839228-10374-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 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 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ 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 852bdc77f..368f24c7d 100644 --- a/example/instrum/Makefile.am +++ b/example/instrum/Makefile.am @@ -11,13 +11,11 @@ AM_LDFLAGS = $(PAPI_LIBS) 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 \ @@ -25,3 +23,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 1bc544dd2..6f2fc6ce7 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,4 +18,5 @@ 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 d925bbe78..f2ed909e1 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -17,6 +17,14 @@ AC_ARG_ENABLE([code-instrum], 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 Mon Feb 5 14:00:27 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: 126892 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2000907ljc; Mon, 5 Feb 2018 06:06:34 -0800 (PST) X-Google-Smtp-Source: AH8x225bcyQ3o++uWQwgI2tQ6Af5cewedAKuaWMcKPq3Q/pVpSdLoWNzI6DC56PxGZWOB9tqUXTf X-Received: by 10.200.58.39 with SMTP id w36mr8169221qte.76.1517839594413; Mon, 05 Feb 2018 06:06:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839594; cv=none; d=google.com; s=arc-20160816; b=N44vQouBbvT07WnrykS8rDkDGgrTF7As3ozZA0mgHWwkhcmo7cuSP/RiLHDnsWuYpd Y9TwBiKbXjxRThyd2T0hCgbfnvQZnPQ5rEMXQGVG+umeIStX3dA4HhSknHBtPgncp+i8 rEvbZF1ChMhDklW8ipVq65q9j70zpuTEq1WPrx6AIfoUBs4+UICR74IWv1UoIEZXvPWq NNI7oqoUZ1k0GxPfZxLHeCvipqZCDC7HixfAsixDi29N2x6iQXxmi+ouD2SFB7VADvl4 +E/3rwWr/q90quioGyGH+5zvON9TdKk3t9jZ+HABzc0B2uB9aYKtQTfaWeU+ptYoD9U1 BR6g== 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=nDcVhbhiEwPoBx2X567O0HthPw4i+XK7HhDfzWwmnik=; b=vtuhE6oRsUTo7TwNQ9HYbfhvZ7Q5Vw0dMGfsgXa1Dj6xNj9RH8c8hfeUYlDYY/aTZd S42qtgy2jpFq5T1DGQgjxs27gnUzYKQFT5oulwxQQtVyj+P6cSjku1PH0OgCHGvNqQDD gshSUwuwIPrHiZxnw7X9/uQcsqoP33qI81nK//cD9sz5a/pdSr5FvEVPrr68GKCeZaBE QY2jvb2FJRb7PWd6t7wixuql+yQDdOPB7XXFAX+u4dDTPbNq/B5acAVl75dNzra8vDdC Iv2JvL7O/ZR/lxkhxpo7YJhRnop4gI8VbU5TSUzqdr/f8YNo5bwzXTfrjl6cvTzK5kJH r3EA== 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 z36si5208730qtz.269.2018.02.05.06.06.34; Mon, 05 Feb 2018 06:06:34 -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 110EB617D9; Mon, 5 Feb 2018 14:06:34 +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 F113F617E4; Mon, 5 Feb 2018 14:02:20 +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 1558461787; Mon, 5 Feb 2018 14:01:51 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 16A656172B for ; Mon, 5 Feb 2018 14:00:37 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward106p.mail.yandex.net (Yandex) with ESMTP id 050E02D848AD for ; Mon, 5 Feb 2018 17:00:36 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id dM9rA5gl0K-0Zdi8L05; Mon, 05 Feb 2018 17:00:35 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0Z24YDUY; Mon, 05 Feb 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: Mon, 5 Feb 2018 17:00:27 +0300 Message-Id: <1517839228-10374-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 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 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ DEPENDENCIES | 86 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 86 insertions(+) diff --git a/DEPENDENCIES b/DEPENDENCIES index 6f374ca92..ad2ef53d3 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -204,6 +204,92 @@ 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) + + ODP example library 'instrum' is using PAPI library to retrieve performance + counters associated with execution of ODP API. + +3.5.1 Installing PAPI library + + PAPI library is available as package in a variety of Linux distributions. If available, + install PAPI from distro-provided package. + + # apt-get install libpapi-dev + + Alternatively, one may try to use the latest PAPI master branch commit for + the best performance and the latest bug fixes. PAPI library is currently at 5.6.0. + + # 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 + +3.5.2 Building ODP with PAPI support + + $ cd + $ ./bootstrap + $ ./configure --enable-code-instrum + $ make clean + $ make + + Note 1: When PAPI is built from sources and installed in a custom folder, it is mandatory to specify + at configuration time the path to package configuration file. + + $ ./configure --enable-code-instrum PKG_CONFIG_PATH=/lib/pkgconfig + + 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 --enable-code-instrum --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 Mon Feb 5 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: 126893 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2001656ljc; Mon, 5 Feb 2018 06:07:22 -0800 (PST) X-Google-Smtp-Source: AH8x227KfZXAiV/3Z1gVBJmXHqJQyJfTrJnpxkjy7mDrZ8MjRtF9RfKW+tXTVfFpTyD+cvjYD9R0 X-Received: by 10.55.165.205 with SMTP id o196mr6914121qke.262.1517839642072; Mon, 05 Feb 2018 06:07:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517839642; cv=none; d=google.com; s=arc-20160816; b=c4nHS/Gy68Timf1RhfulTS38llzHEhfTqcI2jwkVrQgSzcCIIUGfhWTLJj0W6qOIyO qdx0004sxNL6kuEW7yToiQQqr8W1YksIcYDOVdf6EgP+QweqVia+LSf7PUKwNwnkD1A1 l+tAVZhTkI4N0UmK2RCFwGRl8/R8JtMRxaS1egPXhJsFcKAwcx3rlkgOiHRNCQKP4O4b WaGNK85IZdOpZ7py2v49uZ6LPEhFYIEckNBdTTO0KDnvSH86Vmqw1dV860zCHKXXDgvt 1k+5X5U8GvLzGdh6zh1Z0oqEKjlfMDpAgMzp2ocxbDU11Iny7dfeZB7TVinN2uFmx3dl i8aQ== 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=UR+V4OBG/YMkSsBZqKiquLbak9QigciIn/senUDQwgk=; b=keWsJxXekwqMqGwB16T5S9lNJEFvQ99OvYW9AT+ydobDiuaNVEuW5/tMqAUmhZqOKu 6p86jhdYLvxwvAX+xfvYMUdzSwlFxzmDMQ7HcVSlAt03lfPeg3xJMkAhAtiEINBKMqke oLhl2gnbiG5iGIyZI3HFYVQqQvBqsig4TCdb0Itege4sxn86pb1B0XbYEaLBWZ/xTaOw sTIA1SDp3DNmqwoYY9CQlye5o0QjxoQRHj9FUbHC8kqaY5lSeYus9DZTO4UH3/kj8j/H oDG7hkMDDJJN6RqoI93mzbLzwGB3UHTk42MuMGBtBRIGC3lJx92XeBUYVMXsEbiNUyqt S7sQ== 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 h20si3139912qta.418.2018.02.05.06.07.21; Mon, 05 Feb 2018 06:07:22 -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 C022A617CB; Mon, 5 Feb 2018 14:07:21 +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 5CC9C617EF; Mon, 5 Feb 2018 14:02:35 +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 388446172B; Mon, 5 Feb 2018 14:01:52 +0000 (UTC) Received: from forward105p.mail.yandex.net (forward105p.mail.yandex.net [77.88.28.108]) by lists.linaro.org (Postfix) with ESMTPS id 1C42561732 for ; Mon, 5 Feb 2018 14:00:38 +0000 (UTC) Received: from mxback3g.mail.yandex.net (mxback3g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:164]) by forward105p.mail.yandex.net (Yandex) with ESMTP id C9AC640829DC for ; Mon, 5 Feb 2018 17:00:36 +0300 (MSK) Received: from smtp4o.mail.yandex.net (smtp4o.mail.yandex.net [2a02:6b8:0:1a2d::28]) by mxback3g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id YVGdM17OUF-0aD0AeY6; Mon, 05 Feb 2018 17:00:36 +0300 Received: by smtp4o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id saDyFPvH8X-0a2KQvNU; Mon, 05 Feb 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: Mon, 5 Feb 2018 17:00:28 +0300 Message-Id: <1517839228-10374-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> References: <1517839228-10374-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v2 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 443 (bogdanPricope:master_benchmark_pr) ** https://github.com/Linaro/odp/pull/443 ** Patch: https://github.com/Linaro/odp/pull/443.patch ** Base sha: 27a7923236030fed0272cc9072f0cde62496e91d ** Merge commit sha: b70681310d12862313cc0487e0c97b589c76e412 **/ .travis.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.travis.yml b/.travis.yml index e36c7bcb2..b2c5ba878 100644 --- a/.travis.yml +++ b/.travis.yml @@ -240,6 +240,17 @@ install: EXTRA_CONF="$EXTRA_CONF --with-netmap-path=`pwd`/netmap" 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: - ./bootstrap - ./configure --prefix=$HOME/odp-install @@ -425,6 +436,17 @@ jobs: - echo ${TRAVIS_COMMIT_RANGE}; - ODP_PATCHES=`echo ${TRAVIS_COMMIT_RANGE} | sed 's/\.//'`; - ./scripts/ci-checkpatches.sh ${ODP_PATCHES}; + - 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 + - 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 allow_failures: - canfail: yes