From patchwork Mon Jan 29 16:00:15 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: 126176 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2554373ljd; Mon, 29 Jan 2018 08:01:47 -0800 (PST) X-Google-Smtp-Source: AH8x227IPhwdhIlqB9QV88LJb6CITINJ8mYYXJpU+5nrov8Zx9qZBJ3t7Bk2lzmeskdrh+rHZHIR X-Received: by 10.200.58.97 with SMTP id w88mr22095740qte.236.1517241707459; Mon, 29 Jan 2018 08:01:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517241707; cv=none; d=google.com; s=arc-20160816; b=K6rykDWYbLq4+L2nJI5vBWm9bYXJdqExHuh4M1tCC8YqwbT0tE3biHuQMAqh0j1WNQ FZFQDuPAww42CxC+bWe34Lu+VsOQbn3XLeOL1YGjg0w/Ee1Wz9mF2dWFtkuantgaS7rF ZXy0a+ZRq+GQwFq/jQsvWqAzLvvjDYzhhjd/U/wUhavv6ahfKb1IJS4flDgo1dgEzGY9 /DA8swqed0x9gvPyq/uoT5OJNcn8sAiRryNdpJmPyEqADGhF0SUGnNEfa7w/A62U5nBK AR2zQxNx+sFYhDgBiFFDbcHCA/ODuLAZt5CIgK/YTWCu3IPUo5UgUzwfkkpm8FKxZZHY HQPA== 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=I2Ei293Nc8+pHV2xOtXiXRnrk1lXF049zyy/CBgJIdI=; b=BZf8PJrTHlZsdgUEchlzW82bY01XyMDdk0eFltcrxVM2/IWftPNuYSfHvw7abB34g1 Lp11Zb8sOS+BiabEDfIq6EnNYjtxgwbg6rMP09bBBp8i2N7bXdZFmObzExe1EeEHmNC/ wCts39ZuXZkTkFbaP6LeiVa9uNG/Oz3S6YmLLjO4Vq0ky7XtKarcpHyXdiPsuGCOF3pS vFqiHtHsCvu61q+DRc+J3cXFvRdeYLhHqUBLQy5v+99GOSg/ksFQ6WQXypLJD5VrleAb Q9guJEb/D3UaNbo+mpM2EtN6Ti/eIzbObj8N++L3nfHxOz7whEg7iEga6rrSVAcwmb2y CFmw== 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 e10si9966439qtk.367.2018.01.29.08.01.47; Mon, 29 Jan 2018 08:01:47 -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 1E47B6175E; Mon, 29 Jan 2018 16:01:47 +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 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 6EE0260C5E; Mon, 29 Jan 2018 16:00: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 4612960887; Mon, 29 Jan 2018 16:00:26 +0000 (UTC) Received: from forward104p.mail.yandex.net (forward104p.mail.yandex.net [77.88.28.107]) by lists.linaro.org (Postfix) with ESMTPS id CBF9160887 for ; Mon, 29 Jan 2018 16:00:24 +0000 (UTC) Received: from mxback20j.mail.yandex.net (mxback20j.mail.yandex.net [IPv6:2a02:6b8:0:1619::114]) by forward104p.mail.yandex.net (Yandex) with ESMTP id 387D7182DFC for ; Mon, 29 Jan 2018 19:00:23 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback20j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id UMSVMCU482-0NBSBHZJ; Mon, 29 Jan 2018 19:00:23 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0MdeVtHv; Mon, 29 Jan 2018 19:00:22 +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, 29 Jan 2018 19:00:15 +0300 Message-Id: <1517241621-24528-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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 and set PAPI installation folder. 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ example/m4/configure.m4 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/example/m4/configure.m4 b/example/m4/configure.m4 index 208c5d6d7..5122d19b6 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -7,6 +7,22 @@ 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], + [ --enable-code-instrum enable code instrumentation support], + [if test x$enableval = xyes; then + code_instrumentation=yes + fi]) + +PAPI_PATH="" +AC_ARG_WITH([papi-path], +AS_HELP_STRING([--with-papi-path=DIR path to papi install directory]), + [PAPI_PATH="$withval" + code_instrumentation=yes],[]) + +AC_SUBST([PAPI_PATH]) +AM_CONDITIONAL([CODE_INSTRUM], [test x$code_instrumentation = xyes ]) + AC_CONFIG_FILES([example/classifier/Makefile example/generator/Makefile example/hello/Makefile From patchwork Mon Jan 29 16:00:16 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: 126177 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2555340ljd; Mon, 29 Jan 2018 08:02:45 -0800 (PST) X-Google-Smtp-Source: AH8x227YiPpV8JeOpH8beoTBpBwBCpJId7h1zSvtobIT0u0qjNxIfAE4ZnNZHuJh5XD4bnSXVPxx X-Received: by 10.55.6.145 with SMTP id 139mr37288309qkg.285.1517241764936; Mon, 29 Jan 2018 08:02:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517241764; cv=none; d=google.com; s=arc-20160816; b=p+lPrytYyiMA6amP9FDt+xxVABZJv/MIb7L+5ehG04ywTpeaQbEJBSUt/TULxmNsj/ 8IsXw8dB3CK0Uf1cZnzLcd5BzdB3qsD7J/ydSx2zeidT56eaR3YJYERtZI22PArattQP WBXhtk7XKijKXMUPIWZK8opCFj2dO+f08BZQnOv297pMYSFhEpekXrYEiPUGXn2sz2Os EA9UX+1oSB4X/qg4lgcQGzlqfJGInV8hBvObtLKQwOWjDjHKzSNuhNvazIUZPiQsitJ+ pmX46ioPS+2ogIb+kr3/vw5BPztGg6ED5OGk69CDIf98Ujl6hOsm7Jkv1JqujUHCuqKP LvAA== 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=5EEaZdvLloNw9o5xja6FY7T14cLvYWQKg28hsey1nrk=; b=XMZAX3Uk9ZQnhesNP0du1fssA3E+g5luyFESZ5YSzAmqtFyKrrrtetxS8uJnAJUpt3 X0jBW7vDSDPSbrR4k5Lie1GB2CSbQqxaB6pxRCq13ODsJub6Dr/+xUcEtdGqjh+klEdN 2bMBiPsmHHwUvJ5X1Fhj4Iqo+2G8w3BCK6NNICN0mFts8171/AJmp1AuekK//laa8GmD o29AbejawLa51JsMKHXsRKuWmzMZeHWEV9Gu/0yx3DISiwZSswCM5DOokt32kqI0WUDE daPBcJTcO2++taW6zxhjQhI19+FT618wJ4LRpBtTztzb/AmSMiWjEX7+MPJKlHY2Wg7p RvEA== 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 q23si3892422qkj.351.2018.01.29.08.02.44; Mon, 29 Jan 2018 08:02:44 -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 9A6DF61769; Mon, 29 Jan 2018 16:02:44 +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 ACFF261705; Mon, 29 Jan 2018 16:00:43 +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 114266170D; Mon, 29 Jan 2018 16:00:30 +0000 (UTC) Received: from forward102o.mail.yandex.net (forward102o.mail.yandex.net [37.140.190.182]) by lists.linaro.org (Postfix) with ESMTPS id BFA96608C0 for ; Mon, 29 Jan 2018 16:00:25 +0000 (UTC) Received: from mxback12g.mail.yandex.net (mxback12g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:91]) by forward102o.mail.yandex.net (Yandex) with ESMTP id DF20F5A02BEB for ; Mon, 29 Jan 2018 19:00:23 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback12g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9GjXLRGTee-0NnugVeQ; Mon, 29 Jan 2018 19:00:23 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0NdWGkIO; Mon, 29 Jan 2018 19:00:23 +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, 29 Jan 2018 19:00:16 +0300 Message-Id: <1517241621-24528-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ example/Makefile.am | 4 ++++ example/Makefile.inc | 4 ++++ example/instrum/Makefile.am | 20 ++++++++++++++++++++ example/instrum/instrum.c | 18 ++++++++++++++++++ example/m4/configure.m4 | 1 + 5 files changed, 47 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 b6e8d81fe..99c5726f7 100644 --- a/example/Makefile.am +++ b/example/Makefile.am @@ -13,4 +13,8 @@ SUBDIRS = classifier \ ddf_ifs \ ddf_app +if CODE_INSTRUM +SUBDIRS += instrum +endif + noinst_HEADERS = example_debug.h diff --git a/example/Makefile.inc b/example/Makefile.inc index 31bf7c435..78b750cda 100644 --- a/example/Makefile.inc +++ b/example/Makefile.inc @@ -13,4 +13,8 @@ AM_CFLAGS = \ -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \ -I$(top_builddir)/include +if CODE_INSTRUM +AM_LDFLAGS = -L$(LIB) -lssl -lcrypto -latomic +else AM_LDFLAGS = -L$(LIB) -static +endif diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am new file mode 100644 index 000000000..bf2a19c0d --- /dev/null +++ b/example/instrum/Makefile.am @@ -0,0 +1,20 @@ +LIB = $(top_builddir)/lib + +AM_CFLAGS = \ + -I$(srcdir) \ + -I$(top_srcdir)/example \ + -I$(top_srcdir)/platform/@with_platform@/include \ + -I$(top_srcdir)/include/ \ + -I$(top_srcdir)/include/odp/arch/@ARCH_ABI@ \ + -I$(top_srcdir)/helper/include \ + -I$(top_builddir)/platform/@with_platform@/include \ + -I$(top_srcdir)/platform/@with_platform@/arch/@ARCH_DIR@ \ + -I$(top_builddir)/include \ + -I$(PAPI_PATH)/include + +AM_LDFLAGS = -L$(PAPI_PATH)/lib -lpapi + +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 5122d19b6..5a05717b8 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -37,4 +37,5 @@ AC_CONFIG_FILES([example/classifier/Makefile example/traffic_mgmt/Makefile example/ddf_ifs/Makefile example/ddf_app/Makefile + example/instrum/Makefile example/Makefile]) From patchwork Mon Jan 29 16:00:17 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: 126178 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2556180ljd; Mon, 29 Jan 2018 08:03:41 -0800 (PST) X-Google-Smtp-Source: AH8x227WURt0M+/jLQzkAiyI/AF/Qd3Rc7nxJDlI1iBj1+2pgWShGqzs3YU8+p6r1O7AGIvNKEwk X-Received: by 10.200.16.19 with SMTP id z19mr40717370qti.10.1517241820796; Mon, 29 Jan 2018 08:03:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517241820; cv=none; d=google.com; s=arc-20160816; b=oQX0Mjy6hgFFEbg/m/Akta0lTbFCz211HRsVBZEHCZORyvvM0PPCMu9O4oNSaPUZBo bFrXjelWB40oqVa9o2UqlH1FsBgT5R8Jl6iOWhiEhkkuxXIEuPdY0Qq+n4lYyKAGV2uj hAAubYwbyjgfwWnSfPOY5vHXrks+S22QRruFUXeLa4p4MCJp1BcuB56QX3OycKuSiwga +3dcsNFnAy9pcbw04l+Yal67+16fXnFn12vkuL4B01i+XF9mGU/VY1Swbz9nYZ5/vPcw g+vqvSbbq9LTppbh+kRuFlW4isg+QVps1+tEjB86O4EJieelh1ifyJN69Awo6pz5YBFy olVw== 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=GjuSTT922SgjdVbdMCoSaMRzRDdezeCormmlFhrBD4c=; b=ckeTooPk31PsqL/lHM49yhf7WKfnVyJ03u6vn68osp3xtljjIIYEKL0P7GL2fzcx5R ZGKvqNkVBUw0ijC7aSEuML5hDA1bLtMZ9LCF6huRw6qbW+ZKYY21ztDzcOUh5EsGYGXe 9PPk6cZadjuu33ydZrAG4NmVErwp7R/H8i6imKK+jE2xQQJUyLD6T/vf7NHyDlqvaEEC xpgL9bn6/YOAL9bZuS1m2OH0WtK9SpYOqC/YZgyriTb2SigJ6qJfvSQt+vJf7oracLXa uQ0WkenFjt8NveqXuF+P28MjReAL3288liH6qfJLIBIyDX3g00pew/NS0Cr2cTBKGKQi 9D4g== 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 c81si10920795qkb.88.2018.01.29.08.03.40; Mon, 29 Jan 2018 08:03: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 60F4161753; Mon, 29 Jan 2018 16:03: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 0A97061747; Mon, 29 Jan 2018 16:00:50 +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 150A66173A; Mon, 29 Jan 2018 16:00:34 +0000 (UTC) Received: from forward106o.mail.yandex.net (forward106o.mail.yandex.net [37.140.190.187]) by lists.linaro.org (Postfix) with ESMTPS id 632FB6081A for ; Mon, 29 Jan 2018 16:00:26 +0000 (UTC) Received: from mxback8g.mail.yandex.net (mxback8g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:169]) by forward106o.mail.yandex.net (Yandex) with ESMTP id DDABD783AFC for ; Mon, 29 Jan 2018 19:00:24 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback8g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id G6alyVgrwT-0OTCIMYG; Mon, 29 Jan 2018 19:00:24 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0NdSA5p5; Mon, 29 Jan 2018 19:00:23 +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, 29 Jan 2018 19:00:17 +0300 Message-Id: <1517241621-24528-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ example/instrum/Makefile.am | 14 +++- example/instrum/drv.c | 39 +++++++++++ example/instrum/drv.h | 19 ++++++ 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/sample.h | 28 ++++++++ example/instrum/sched.c | 43 ++++++++++++ example/instrum/sched.h | 19 ++++++ example/instrum/store.c | 126 ++++++++++++++++++++++++++++++++++ example/instrum/store.h | 36 ++++++++++ 14 files changed, 618 insertions(+), 2 deletions(-) create mode 100644 example/instrum/drv.c create mode 100644 example/instrum/drv.h 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/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..d5111c16c 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 \ + drv.c \ + sched.c \ + instrum_common.h \ + sample.h \ + store.h \ + papi_cnt.h \ + init.h \ + drv.h \ + sched.h diff --git a/example/instrum/drv.c b/example/instrum/drv.c new file mode 100644 index 000000000..d82018ecc --- /dev/null +++ b/example/instrum/drv.c @@ -0,0 +1,39 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#include +#include +#include +#include +#include +#include + +static int (*instr_odpdrv_print_all)(void); + +int instr_odpdrv_init(void) +{ + INSTR_FUNCTION(odpdrv_print_all); + + if (!instr_odpdrv_print_all) { + printf("odpdrv_print_all: Not Found\n"); + return -1; + } + + return 0; +} + +int odpdrv_print_all(void) +{ + int ret; + + STORE_SAMPLE_INIT; + + STORE_SAMPLE_START; + ret = (*instr_odpdrv_print_all)(); + STORE_SAMPLE_END; + + return ret; +} diff --git a/example/instrum/drv.h b/example/instrum/drv.h new file mode 100644 index 000000000..12441a7e4 --- /dev/null +++ b/example/instrum/drv.h @@ -0,0 +1,19 @@ +/* Copyright (c) 2018, Linaro Limited + * All rights reserved. + * + * SPDX-License-Identifier: BSD-3-Clause + */ + +#ifndef __INSTRUM_DRV_H__ +#define __INSTRUM_DRV_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +int instr_odpdrv_init(void); + +#ifdef __cplusplus +} +#endif +#endif /* __INSTRUM_DRV_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..05b38da68 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_odpdrv_init()) + return; + + if (instr_odpsched_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/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..aa338aa6c --- /dev/null +++ b/example/instrum/store.c @@ -0,0 +1,126 @@ +/* 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]; + +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) +{ + return papi_term_local(); +} + +static void store_dump(void) +{ + 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; + + 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 < SAMPLE_TAB_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); +} + +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(); + 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 Jan 29 16:00:18 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: 126182 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2559406ljd; Mon, 29 Jan 2018 08:07:36 -0800 (PST) X-Google-Smtp-Source: AH8x224sl6eiKvlX79itKExQtPftxTFXjgVy4zX10+XQYSYHl7dYw5ONIa27y61Plfj3RQCx/Qys X-Received: by 10.129.159.140 with SMTP id w134mr17993833ywg.469.1517242055744; Mon, 29 Jan 2018 08:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517242055; cv=none; d=google.com; s=arc-20160816; b=HnMaCt4KyWbEfguOp/0DbnZ93+gIr54vsa2Sgaf7wrmjRMNRQKb3264EBqXnLHO094 x2nb+wgmEfA1D7DMBxt5DAKoGe7G3aPbeTq+XJYZ/9CDRHl8pOxakUps7GFxnvk4JSqy AX0Uy1ZLfUd7gip1q7ti/KVWBYesJWPPB32i9vuspMv2jFwgpypENHUk6fm0TKjYWnwP jdR7J2Lkb8bStCRWzWcks6W0hwslpym19y+R+Qkb0TxsHIPC2oOwgl9A6VXoCZ3PaXwL uBatJpDMs2hFHDW46TrjmRnXwTY2hv9EGttpc4EenXAFuQs0iaE9Ag1RLPG6gkXHopIm xXMA== 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=EVxMb6P4ZCjHIGDA+x9CYMX013iewbtH1nbglRkm7r0=; b=YAXH4Yp8bpZo64q9/ERgg0wbNJEWm0m121sOMBDbC0UVmFveABu3k9FtBrX7H9NQF8 qeF1ilORwwPmT0J3S9rWjGWnIRCtsK+0Ku0IreLeVYK2Kh4T8/sJHzBryaSh79epKK+x yJSU6rUPtHGZZkoiIjVATuAIRXe7LuAV+Esbs4I1cUYr6/pRS9s/fI1o54Sp6EABEmCK XYb6Oz9jjzaSNhZH4UElPgRQwlfERPqVVyuNB3kKZgXE4ju+0f3Y4FpB8XxVLOXnJFbZ 89Na2eSINpwtQSSBexZeqnB+TpgwLY+fe4tVcPswhJ4RbxRURvubS2Gjnfpe+eezYune dB3A== 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 u94si4969778ybi.702.2018.01.29.08.07.35; Mon, 29 Jan 2018 08:07:35 -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 52F8B6171E; Mon, 29 Jan 2018 16:07:35 +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 46A7061761; Mon, 29 Jan 2018 16:01:09 +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 BDF556173F; Mon, 29 Jan 2018 16:00:40 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 1739760887 for ; Mon, 29 Jan 2018 16:00:27 +0000 (UTC) Received: from mxback17j.mail.yandex.net (mxback17j.mail.yandex.net [IPv6:2a02:6b8:0:1619::93]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 93A6F44424D0 for ; Mon, 29 Jan 2018 19:00:25 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback17j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id nFF5qWJAsU-0PgCYtIE; Mon, 29 Jan 2018 19:00:25 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0OdWvR60; Mon, 29 Jan 2018 19:00:24 +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, 29 Jan 2018 19:00:18 +0300 Message-Id: <1517241621-24528-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ 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 aa338aa6c..ccc6f05ae 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; int instr_store_init(void) { @@ -38,6 +39,7 @@ int instr_store_init(void) if (papi_init()) return -1; + counters_cnt = papi_counters_cnt(); return 0; } @@ -78,7 +80,7 @@ static void store_dump(void) 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); From patchwork Mon Jan 29 16:00:19 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: 126180 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2558450ljd; Mon, 29 Jan 2018 08:06:25 -0800 (PST) X-Google-Smtp-Source: AH8x225DNzbxFeWVkJnVv5+JjQAG7gHXuaBj/8xg2C2KyobuLlLjItC0ZJ0IbNzn1JfNAICuC46I X-Received: by 10.13.242.68 with SMTP id b65mr12284636ywf.399.1517241985575; Mon, 29 Jan 2018 08:06:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517241985; cv=none; d=google.com; s=arc-20160816; b=qKTndYvFrvnKWzNymdmHN24ixsDvUTZU1uAP2Zk1EecyXkwRVwrRNPGJbQFe2qV0gm +AFyC8x5VpIXImz9tRmT7NrP31KJY5Kqn0K55K1RpU6YkrgNRExorNkfyp8pvJm4biiy Xnc6wRlzXeaV/0hpOmObAQDLP9Xr6qU8F1IT+x+Z2VpOwbXkoQ9QXHzEK1qhZqSh+9Pi b8HxG75rfmrRPT6gI07irVhIy8R6Wikq6RHhM3IX7ekT6VhI23NSLeXGDRqUtuReH70M CONM2YkVyb7w0brsRzRO5OnyOCSne6SagJa0H6PnNcaS2JodCSrc89hDu+7UWgpRRSyI 5/VA== 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=GVScX6V4h5uGCVrUggPyBLctapre37BHyFTCuKPDkLk=; b=JEoFAw15FKzhOgakM/mgw/qv2sOY38ky+5DvLlaLDAiq85zfyzVEBMGrd6A3MY3mXZ N3NkrI4HAt/jsSGDCpFmSbarD/JCZM2C2NratuTMPUm4RM3/EyYCBPcxYGjMixt3/zE5 ez//nppDEsxQg0UZSsYBIFKuaO7Oavy49IuxgNGwSpJU0FFe5n2b/W74dUEYBYAZxevF gses7eEqEeMdQAt/B+RjvvB0MduO3tbR+uLDTaG05RZrs79lvGVdvhVqFwVwD3W+xBHE gvc6ymyF2P9aS99Ovb4UDZSUfugd1uHK7C7wq6oOnokOfu0t1YnLFrnVKCB20syl0H5k Bsmw== 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 f64si2134500ywc.677.2018.01.29.08.06.25; Mon, 29 Jan 2018 08:06:25 -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 2982660956; Mon, 29 Jan 2018 16:06:25 +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 8E08261754; Mon, 29 Jan 2018 16:01:00 +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 3EF4160C5E; Mon, 29 Jan 2018 16:00:37 +0000 (UTC) Received: from forward103p.mail.yandex.net (forward103p.mail.yandex.net [77.88.28.106]) by lists.linaro.org (Postfix) with ESMTPS id B7A2F60912 for ; Mon, 29 Jan 2018 16:00:27 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward103p.mail.yandex.net (Yandex) with ESMTP id 23D982182034 for ; Mon, 29 Jan 2018 19:00:26 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id hHAlNwpUni-0QLCZarn; Mon, 29 Jan 2018 19:00:26 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0Pdeh9hd; Mon, 29 Jan 2018 19:00:25 +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, 29 Jan 2018 19:00:19 +0300 Message-Id: <1517241621-24528-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ example/instrum/Makefile.am | 16 +++++++++++++--- example/instrum/drv.h | 3 +++ example/instrum/instrum.c | 4 ++++ example/instrum/sched.h | 3 +++ example/m4/configure.m4 | 9 +++++++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/example/instrum/Makefile.am b/example/instrum/Makefile.am index d5111c16c..e1fdbf7ab 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 \ - drv.c \ - sched.c \ instrum_common.h \ sample.h \ store.h \ @@ -30,3 +28,15 @@ __LIB__libinstrum_la_SOURCES = \ init.h \ drv.h \ sched.h + +if CODE_INSTRUM_SCHED +AM_CFLAGS += -DCODE_INSTRUM_SCHED +INSTRUM_SRC += sched.c +endif + +if CODE_INSTRUM_DDF +AM_CFLAGS += -DCODE_INSTRUM_DDF +INSTRUM_SRC += drv.c +endif + +__LIB__libinstrum_la_SOURCES = $(INSTRUM_SRC) diff --git a/example/instrum/drv.h b/example/instrum/drv.h index 12441a7e4..ed3dd7a08 100644 --- a/example/instrum/drv.h +++ b/example/instrum/drv.h @@ -7,6 +7,8 @@ #ifndef __INSTRUM_DRV_H__ #define __INSTRUM_DRV_H__ +#ifdef CODE_INSTRUM_DDF + #ifdef __cplusplus extern "C" { #endif @@ -16,4 +18,5 @@ int instr_odpdrv_init(void); #ifdef __cplusplus } #endif +#endif /* CODE_INSTRUM_DDF */ #endif /* __INSTRUM_DRV_H__ */ diff --git a/example/instrum/instrum.c b/example/instrum/instrum.c index 05b38da68..93b6cc78f 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_DDF if (instr_odpdrv_init()) return; +#endif /* CODE_INSTRUM_DDF */ +#ifdef CODE_INSTRUM_SCHED if (instr_odpsched_init()) return; +#endif /* CODE_INSTRUM_SCHED */ } static __attribute__((destructor)) void teardown_wrappers(void) 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..3e7a69112 100644 --- a/example/m4/configure.m4 +++ b/example/m4/configure.m4 @@ -23,6 +23,15 @@ 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|ddf 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_DDF],[test $code_instrum_profile = "all" || test $code_instrum_profile = "ddf"]) + + AC_CONFIG_FILES([example/classifier/Makefile example/generator/Makefile example/hello/Makefile From patchwork Mon Jan 29 16:00:20 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: 126179 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2557488ljd; Mon, 29 Jan 2018 08:05:17 -0800 (PST) X-Google-Smtp-Source: AH8x224qLUN19tM71j3nkq6q2S/WZWDGcDv3GdSUk9e2+UL9GDazDPkqBZOD9birWLFa6LwU6xl5 X-Received: by 10.37.7.135 with SMTP id 129mr17098430ybh.42.1517241917070; Mon, 29 Jan 2018 08:05:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517241917; cv=none; d=google.com; s=arc-20160816; b=sV+GC54A6i4zfTB4SavauZeau6aasJA8+aVeYEgdgZf8ZnKrEXnveP4oOTvNqEWhS3 QLphniadHBGVJjcNSqDfG+uW5yxUw4nqA+hc4lVJym3Kdnw4HVql33nBIHoO/uJ/PWLn 879/6v9TLiJ++4kZAQQB7APtcinGyel49aXK1VYpQGwUhk59kxRgSMzMUjhirwkT5clG 3xYKl4XubdgsBvTz1yyyUfhcIeEaR5CKDfi1Go4/F3O5RRx+bsEoYvYWZcTUiZdlWJwX SLbqPC2wT1pUGrzCcSW7RYALQ3BrItG3X2DEptlIy1v3ZbAdhxnqUoro8fCaE4Gca9U7 Vo7w== 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=zBC+0G49dGi2tV4rHm7bygsC8vw30gLtUHehz6m1Hl0=; b=G/95BZdurhiml3+ow06ZzS/tSW2HvWTM47yboeMDMdR9RJGHakGsaNEIlWVPW0Wo+i dCwr72Vl3fWJlAh6+jPMNYSPye60vxbD1NyasTBDBBlXc9no945FyUoPfzvAJ2ZIvBWV gUGzj0yUWB48x84xMJwkdy5T7tkMlmaPwjbRfPVF9v6xWAGz1BveAsmVwf5xEepeX+lF HmjnsEW0eghjG5yRKBCyatPU4dmtqu6VQ5D+Ghd73QJM0ZYIsXZys+dstlhx3PC3Xlxo jOO4A81aHu/ZmCEN3RWmvlKPZA0lvoeXCqjEKvlwtM3+MU74/WPIdbPBUidM78214Fjw dXaA== 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 n30si1657342qtc.384.2018.01.29.08.05.16; Mon, 29 Jan 2018 08:05:17 -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 AC84A60881; Mon, 29 Jan 2018 16:05:16 +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 44AA06171E; Mon, 29 Jan 2018 16:00:58 +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 6C9B261735; Mon, 29 Jan 2018 16:00:36 +0000 (UTC) Received: from forward104o.mail.yandex.net (forward104o.mail.yandex.net [37.140.190.179]) by lists.linaro.org (Postfix) with ESMTPS id 435EF60C5E for ; Mon, 29 Jan 2018 16:00:28 +0000 (UTC) Received: from mxback2g.mail.yandex.net (mxback2g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:163]) by forward104o.mail.yandex.net (Yandex) with ESMTP id CCBA07022DC for ; Mon, 29 Jan 2018 19:00:26 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback2g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id k0Nib4F8ic-0Qd49Jhp; Mon, 29 Jan 2018 19:00:26 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0Qd8397C; Mon, 29 Jan 2018 19:00:26 +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, 29 Jan 2018 19:00:20 +0300 Message-Id: <1517241621-24528-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ DEPENDENCIES | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/DEPENDENCIES b/DEPENDENCIES index 008c4df4d..5d5cb77bc 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 Mon Jan 29 16:00:21 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: 126181 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp2559371ljd; Mon, 29 Jan 2018 08:07:33 -0800 (PST) X-Google-Smtp-Source: AH8x225q04FWqxlcgI6mk/SOn9isFRguUlCiek8lYToQsWCwSFjgqDN9oQX/C0AQ4JHk/YrMQomz X-Received: by 10.13.230.3 with SMTP id p3mr17473242ywe.137.1517242053478; Mon, 29 Jan 2018 08:07:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517242053; cv=none; d=google.com; s=arc-20160816; b=afVs2lBj0p+onayql11/Phnb2drN+/GXQIMcjaZQw2aeXYVv2NDaWWtR7fWo5oRw7h e+Wz37V1PRqGtqc2XXDixQwVeiWi9gooQDekhGzotdoSjcmKGwcTUTkj7XmskuMqhG+W nfI1VtWtLj8KMOUvM1idaRfRyTkjaBlgE04C38sWHfwOW6E70F5erA1fBnFcFPlDS33a mTcwr0+cSVrnh8SSbmrjMhb8Gx/NrDTfjCeVPJKJM4uCvq3xVwvRkWzrJ7TpvpDpaapq 3O9p586UtyHkBIx5mktmiNkPz1JF/3BG28oma3d4RHzrsH7g4C3JUIkw9dUsEMDVTtGp LEEA== 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=nmCCPQ54hdvZdvKRWX8KtFTrLyJhicEnYiADGjTjN3Q=; b=O5ZJtyKIJhF2HrrjjO3PcOWJA0BQElIT7p+9J6yWiR85n4an7SLyRMaqGrpcXqzZ7F UQOyi8mDkD+zDRYMqSjsQrPqOGFmbjEswyUCDHtiS6Z5hl/mqi0Jdq2s3cxx6+pSrlwz KoeU6rBsb0fa2Oyn9x5UZNDLmbOLGyBediQbZi9grxlUVuHtFDgI0/f8lXPxR5w69Kq8 8UyT1qCDuG3xWd/fEWu3HjLVoEskiN1+XylJi5HWqHs+di1ZU5I8TEyrKODrhN0w44ID WCoTc2rTTllJxAHBvG7JqWXyTyx5vo6GrL7HyQ+eoALLIYumqs50W6WvBxWToWAzBl7D niYw== 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 v185si2219422ywe.796.2018.01.29.08.07.33; Mon, 29 Jan 2018 08:07:33 -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 0A8C061719; Mon, 29 Jan 2018 16:07:33 +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 D6C206173A; Mon, 29 Jan 2018 16:01:04 +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 0ACA160912; Mon, 29 Jan 2018 16:00:38 +0000 (UTC) Received: from forward102p.mail.yandex.net (forward102p.mail.yandex.net [77.88.28.102]) by lists.linaro.org (Postfix) with ESMTPS id D9E5760CA0 for ; Mon, 29 Jan 2018 16:00:28 +0000 (UTC) Received: from mxback5g.mail.yandex.net (mxback5g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:166]) by forward102p.mail.yandex.net (Yandex) with ESMTP id 59170430262A for ; Mon, 29 Jan 2018 19:00:27 +0300 (MSK) Received: from smtp2o.mail.yandex.net (smtp2o.mail.yandex.net [2a02:6b8:0:1a2d::26]) by mxback5g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id SUeFTkNLQb-0RoKY3eH; Mon, 29 Jan 2018 19:00:27 +0300 Received: by smtp2o.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 1WljkUuA25-0QdKgL6X; Mon, 29 Jan 2018 19:00:26 +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, 29 Jan 2018 19:00:21 +0300 Message-Id: <1517241621-24528-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> References: <1517241621-24528-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 406 Subject: [lng-odp] [PATCH CATERPILLAR v3 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: 5251bda54b51d3754aaf8c988aa959b48b4d25f9 ** Merge commit sha: 2d6677b6a3794cad32abe2af7314215ea22921c3 **/ .travis.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.travis.yml b/.travis.yml index f5a67781e..a1f953e45 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,16 @@ 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 + - sudo LD_LIBRARY_PATH="/usr/local/lib:$HOME/odp-papi-install/lib:$HOME/papi-install/lib:$LD_LIBRARY_PATH" LD_PRELOAD=libinstrum.so.0.0.0 $HOME/odp-papi-install/bin/odp_hello -c 1 -n 5 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