From patchwork Tue Feb 6 10: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: 126974 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2765402ljc; Tue, 6 Feb 2018 02:05:49 -0800 (PST) X-Google-Smtp-Source: AH8x224wk+wdyZApR/uw42bweeEfnWNCFI4doU+YNJBvRcPXVVbESgGGGGq58ET3gPYekZFs41GS X-Received: by 10.237.51.37 with SMTP id u34mr2690460qtd.205.1517911549440; Tue, 06 Feb 2018 02:05:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911549; cv=none; d=google.com; s=arc-20160816; b=o/7qtj54tdIo+lBXv2J6BmZz8xaNumQT1HiZN+C9Ti0XOeIpYBjPMw/w9KDesNhdEY GVwNuPHqwyScFv4DfyhVYjaFYTJh5S2MMdMemIu7M0LVobgJBBqs/F8cbuIxukB1hmEZ bie0WnUAWqAcSIIesS2uVdw6UHHjKhN/K5emajmN/LixbTUnyKKtVPPqaRAfZClR1mQW hwaDoJmmJxoEPx/O4xAGdUr7H3h3T6LFv3NE20l/xohr6hjbW82RFH/YosAk+VV3RrHW GDcHkZ5GxEp0LcRQxU/4PzRZuriWmvg8xZsd24R28KZcwwqYMPSIPqh3s/1+EPh5NoQg U+1w== 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=e7AVwCWmVp//Jx8gWbf+o4hG0QB1fn2uVzxKRAff8yg=; b=A4ycTB+j15HaqTHChw6WDp6STmnrmwWPQ4cPqFpp7e7o+ETDDoyWw+zuBoYyRVpmUS ONt82g40Gx1CuDwKXujWhFlFz6yhxyrx9pgRnyDiYvnoGpjdEMxnY+kVB75W4z2rB/ee EmTlUSbghtvmuDYOUTcBuM9dvSrloNfYZCG+YUwKSu3bFVJJZ6zzrmEutg9IP9kdiVnj 04c/SIfvxIBZg7KEdaKiVs8RPdHyi9k/BKTpt1hzth0WP+jEJrY5LUDlf6YBRk2H/XG1 0j4cH3PNpg7Zh1cDpT7gSqrmKeD+7wUCMuu9KbjRNy9RJUnVClcNyujS06KxAt4mLRJu XP/w== 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 r49si3196021qtj.205.2018.02.06.02.05.49; Tue, 06 Feb 2018 02:05:49 -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 0DB9C616EA; Tue, 6 Feb 2018 10:05:49 +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 C28FB617A2; Tue, 6 Feb 2018 10:03:13 +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 436A9618F4; Tue, 6 Feb 2018 10:03:02 +0000 (UTC) Received: from forward103j.mail.yandex.net (forward103j.mail.yandex.net [5.45.198.246]) by lists.linaro.org (Postfix) with ESMTPS id 49C8E617A2 for ; Tue, 6 Feb 2018 10:00:37 +0000 (UTC) Received: from mxback8j.mail.yandex.net (mxback8j.mail.yandex.net [IPv6:2a02:6b8:0:1619::111]) by forward103j.mail.yandex.net (Yandex) with ESMTP id D770634C2686 for ; Tue, 6 Feb 2018 13:00:35 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback8j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 8zYcaggRDh-0ZruDSH7; Tue, 06 Feb 2018 13:00:35 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-0TwKf2va; Tue, 06 Feb 2018 13:00:29 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (Client certificate not present) From: Github ODP bot To: lng-odp@lists.linaro.org Date: Tue, 6 Feb 2018 13:00:16 +0300 Message-Id: <1517911222-3896-2-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126975 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2766229ljc; Tue, 6 Feb 2018 02:06:52 -0800 (PST) X-Google-Smtp-Source: AH8x227jj6wu+FkdS/C7Iluo/TSmw1/QmNuenw8dv06c3czHI0s6h3KHabMaJmJ+tZ8jM290X7eD X-Received: by 10.55.175.65 with SMTP id y62mr2406364qke.20.1517911612033; Tue, 06 Feb 2018 02:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911612; cv=none; d=google.com; s=arc-20160816; b=TWON3H+Z7CVSP0Dn9GfcT4XnU6rbhNgTO6LXWUvVdhtEG8gUvqHIsLxr05afxkhV+p rkwY+Bf0ptc22wWPp3GGoKNFClQ/Z9FMvdNcuokayDeeKGet4EeR683x+fQvkRbTuLol 4SPq0DFpMcCXtTaEDlQ30h+UGLXFVwYVGvsbLxa4sQUC31r6fzWnURWMFHAI8ip/zUYN v+9GHpWiqQwdmCq+pOBt+GMTADGZoT+jQDDjrKcshf0D5PCJv8QQTguni1wbtPoofHRl +LUgvlhuzSvgqsQdbZpe3Cp7LpIjWWxhAU42befYpnjNSGvL9wNB09bhmaP9i+HXWMnn HFRw== 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=8/9lYamM2L8SvilyuQRBedGV/7k07pWO1YLFCnPn0tI=; b=Cia1txopIuK3Xe5pv1g46SXWqOuOS1gCJONC5dxY/V8a4G6j07ogTBi2TU/X7JZTpv YDg2E+LZxwhmSkTIXB7iMZoVfxyMMbsFjlFfsxbIGouLFiUVjcedDBOPQBgbhUUM62OD S7rvkn5lhF3QykaFlHg0PlGC7Ch+xRZu4TxicxIIb5Xl7J+K/pXlqAHu/S+iLDMvsaTi NOu11er89P5LC0NgNf+d1pT3WGuM8eUZyMlwfMfvjfOv54Mfb3lLvOVAXGQ0yboJ2fZ6 7w55JomH+cmIaxBfKrXnAyQUqbzI9k8eznf9YU7g9xzXlz50QqVyj6BUKD7Qzmp0Ypfc ytGQ== 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 l65si2087384qkl.383.2018.02.06.02.06.51; Tue, 06 Feb 2018 02:06:52 -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 B13F061792; Tue, 6 Feb 2018 10:06:51 +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 3DC8F617DE; Tue, 6 Feb 2018 10:03:38 +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 D40ED62783; Tue, 6 Feb 2018 10:03:32 +0000 (UTC) Received: from forward106j.mail.yandex.net (forward106j.mail.yandex.net [5.45.198.249]) by lists.linaro.org (Postfix) with ESMTPS id 73A6D617DE for ; Tue, 6 Feb 2018 10:01:01 +0000 (UTC) Received: from mxback15g.mail.yandex.net (mxback15g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:94]) by forward106j.mail.yandex.net (Yandex) with ESMTP id 667C61801792 for ; Tue, 6 Feb 2018 13:01:00 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback15g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 4sxXDT3eYv-10jiaeiU; Tue, 06 Feb 2018 13:01:00 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-0ZwGvjSV; Tue, 06 Feb 2018 13: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: Tue, 6 Feb 2018 13:00:17 +0300 Message-Id: <1517911222-3896-3-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126979 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2768765ljc; Tue, 6 Feb 2018 02:10:27 -0800 (PST) X-Google-Smtp-Source: AH8x224n1QAIBb6sRlw2yUVgrC36iLF+4Yiv2r9y20rRJ4Xb/3PLlB5lz/GrQS4YGvVRkHXgympe X-Received: by 10.55.67.131 with SMTP id q125mr1993654qka.227.1517911827611; Tue, 06 Feb 2018 02:10:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911827; cv=none; d=google.com; s=arc-20160816; b=r3C27K/+b9NdKWqtsnmxiyvhgXxz6bWxDy6EqVuF228qsluxF7X7aGWA30iIktGHhb FIu9R1qqf3lgvojX11LpRDjSkfY0fHm1NyHmjuD+nU/2ymgq7L2qOdrpXO4B4NMJvbxT NDsLAaHmuSD93G2Uhv+qDZ5TMRtW0HjnGV2lTaI+WilfEdTlJd+j9p7DYlQRz3tWtZCm 2+BM6/L8j5yCiz2gewOvQMlvbRl4YDq9GZGc5CxB07hU3eIh2tnK2TH5c4GAWE0MTtl/ 2tznx1IBzixIhfy+uqp5z7UMr+5+eRurhMG7fJUZdeWvAXtlHxyPhQnCpCJ3pebFcjj9 hpng== 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=C7w1uuI2CDMB5j1vSZYI14eX0A6+gKrjqE8ux5JG8e4=; b=vb1z5WTG9tOctZIwlLtFQ0VGy+w+mQHCrITfZocjUUt+NvgcGyZYZSny43VTbaJGGI +9j3deuLZqlbQcagNdci+CZmoZXcM6XPl+nwKYH5Za9fhmqbgSFMNBvd074XLKWlMlnx 4L3ZI9DIfcZk9uh0ycgpXatyeFBDBQkTWSiPdYr58DuEDCnlILXJaNr3TdnrmT38h0dW V9ANcKTTlFiDUX3uCzzO3oUuIqG83CYnbwgh/SOhUfB4O/DkaluhvqO7VRM1T/O6OBmk 9T5hReXzG2t33zXJ/PQ3liJuDPHkpniIm3sz8GQKMuyIPYohRHfG/9XOiWaaWc+Gmd4D B3DQ== 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 a21si1079408qtd.155.2018.02.06.02.10.27; Tue, 06 Feb 2018 02:10:27 -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 43F54609B2; Tue, 6 Feb 2018 10:10:27 +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 3F8C06278C; Tue, 6 Feb 2018 10:04:53 +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 A4E176278A; Tue, 6 Feb 2018 10:04:45 +0000 (UTC) Received: from forward105o.mail.yandex.net (forward105o.mail.yandex.net [37.140.190.183]) by lists.linaro.org (Postfix) with ESMTPS id 353DD6181C for ; Tue, 6 Feb 2018 10:02:12 +0000 (UTC) Received: from mxback14g.mail.yandex.net (mxback14g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:93]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 4E2CC4442966 for ; Tue, 6 Feb 2018 13:01:07 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback14g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id rL0TuTsTZl-17E8NesF; Tue, 06 Feb 2018 13:01:07 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-10wexBNL; Tue, 06 Feb 2018 13:01:00 +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: Tue, 6 Feb 2018 13:00:18 +0300 Message-Id: <1517911222-3896-4-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 3/7] example: instrum: use low level API to retrieve performance counters X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Use low level PAPI API to get performance counters. Exemplify on some ODP APIs. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126976 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2766830ljc; Tue, 6 Feb 2018 02:07:45 -0800 (PST) X-Google-Smtp-Source: AH8x225BiOsYGdnlTehbbQyRQPZj8JcWly5PDQHHUgA/APBGkbfeF7Fjbz0IWtxRQSgSzeFyF2ZS X-Received: by 10.237.49.105 with SMTP id 96mr2856556qtg.52.1517911665393; Tue, 06 Feb 2018 02:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911665; cv=none; d=google.com; s=arc-20160816; b=A3SkB/gULsvn8OJro+7gA/x+S2wqCLJYWkQ/Bm9LIrJNiW9Od3X3u2Dn2iM5COhCkq ILnr602XLz7zQgy3PhhuiawxzjxcX7245bCZMOp5Ay/rZXGXmmOzhWrCNVH20RqkL8WB ydh0JwVbOD5KIB29nGcYyTQNtkH7wQeRqOy5RwimbMYZCd1ypzb2I21HA2AfZPIx275N mS11jDczgZwbF3HwvXtVlD1yhmpnp8Lq+3Lnm0ODBFLibmj+tdeUKxukckIsOBpLPfah JnyPGZaZHZzNkmQPPG1R1JbnoPRO1zw5CrUv4Ln71jCjdVy11ohzZ5UFJ94Tn3G3rqzY RZKw== 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=2qwaHuZ2Xudv85LInLRaUgTpzsfK8j86EiKP5CMsDLI=; b=vR+nxAFI65MfpdlQW+c/Fr3cWgSk27bmo2PcYDilJxyq+b1b7Mg9N2nPR6wq54eE8b ASeyMbilM0U3C2r8cSEA0kmkQl/hqZiwxQutBSh4KuNlZwB08p8cjnrZuF61ey8dUIH0 pJbaMK6p8H3bqaCyPx1dZszKPtrlQQVRFm/xhEfTR7HbOHzHnM60fIopEM987ktYCFd7 44sCEKoJ0ymlia8pIPutYLFv97Oz/U5Bh066r8KHNB9Ffns9pyNDnEyuCjWeGYwyXeqF AjZCQxOsjKto2ixGvnGjFjw+xFjUPN3EZzSn60EWudIEHK3ydkx0yfcEyotRJzjJTjy1 XJmg== 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 g7si4311776qkd.453.2018.02.06.02.07.45; Tue, 06 Feb 2018 02:07:45 -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 EB44361828; Tue, 6 Feb 2018 10:07: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 AD51861778; Tue, 6 Feb 2018 10:03:56 +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 D3E3E61784; Tue, 6 Feb 2018 10:03:51 +0000 (UTC) Received: from forward101o.mail.yandex.net (forward101o.mail.yandex.net [37.140.190.181]) by lists.linaro.org (Postfix) with ESMTPS id 65E6B617EF for ; Tue, 6 Feb 2018 10:01:15 +0000 (UTC) Received: from mxback19j.mail.yandex.net (mxback19j.mail.yandex.net [IPv6:2a02:6b8:0:1619::95]) by forward101o.mail.yandex.net (Yandex) with ESMTP id 1535B134487B for ; Tue, 6 Feb 2018 13:01:14 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback19j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id 9VXuCUy2cq-1D50i5hO; Tue, 06 Feb 2018 13:01:14 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-17wiqrTO; Tue, 06 Feb 2018 13:01:07 +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: Tue, 6 Feb 2018 13:00:19 +0300 Message-Id: <1517911222-3896-5-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 4/7] example: instrum: configure papi event set X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Configure the set of papi counters to be acquired via an environment variable. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126980 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2769940ljc; Tue, 6 Feb 2018 02:11:58 -0800 (PST) X-Google-Smtp-Source: AH8x224AIeegw38AFMrmGhnNllG4Vbd4rFpd4Byzv/nsQzvy1jlnE7oRMaw7veCWEbtknPsh8885 X-Received: by 10.55.24.147 with SMTP id 19mr2738210qky.173.1517911918588; Tue, 06 Feb 2018 02:11:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911918; cv=none; d=google.com; s=arc-20160816; b=ZpPNczfPJVfWh+AWugjDxSQf2Fvjrj+Xf83wLaRiVcY9oaGt2zuSrqXWCh3tHDxz1d vv8+jMazaC7fByGVXI3lcjJerZuy/liHD5b+loknADc8vSM5G4Mnb9WN9luzEp064kpz nBx3pQhkFb8xpiSuUmWE8hP6TiHNVmrI3oinKMPF1rzzF8MdjbxxkqBtFYspdtl+gIeb b0wvP/QQ7M0EIWd11DnWmHF5fZlaFYOCp+3DepQvNN269QyazL2DtCue9FxMMRKF8AGO uNN4XVosOf94ot+l/PwIMOt85QvTN2mvGPXCxyHkldCflqpcbcDTP6TKAe68GMOcA138 wFHA== 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=NonuNpCp00wKyXmDUlXxclrRs2ZZPU2K4aSu8WdZ00o=; b=XS7uuXU9Ce2M6ZdLu2vMDGyYS8R9DN4fnQPdhCAKEk+Jy5cp07rnIbCpxmSzVkQyk5 7LfI+4tIJZ48c1byEnbvplhAYddyDs1q3EpwddJ9V9womDIZoNOoMxtlWHgOz9oB0FSo B22Y/c6fu42M8NI3zjPb+6tuqutwHp24qaU597lt5hTrDMtHPx+Tj5eJVcWo7FG7+zm4 q2QFj6EJB8KPXI4L01Nf7LpXkvE4a/vFF1waxvkb0ex4QKODmc8Ug9NT4+WI4gSr0EJ3 lSPhDN+b1vf4qu4cmKEU6s4+ihXlbGO/CUPtHfCmY7DtuXH/UsPaKC4DeYkZC/67Jbcf 3Yeg== 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 n186si6970122qkc.309.2018.02.06.02.11.58; Tue, 06 Feb 2018 02:11:58 -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 43E7D6182D; Tue, 6 Feb 2018 10:11:58 +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 8C1816278A; Tue, 6 Feb 2018 10:04:54 +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 C31746181C; Tue, 6 Feb 2018 10:04:47 +0000 (UTC) Received: from forward106p.mail.yandex.net (forward106p.mail.yandex.net [77.88.28.109]) by lists.linaro.org (Postfix) with ESMTPS id 126E46181D for ; Tue, 6 Feb 2018 10:02:17 +0000 (UTC) Received: from mxback11g.mail.yandex.net (mxback11g.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b7:90]) by forward106p.mail.yandex.net (Yandex) with ESMTP id D61D52D83E68 for ; Tue, 6 Feb 2018 13:01:20 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback11g.mail.yandex.net (nwsmtp/Yandex) with ESMTP id Ah2ahEj2Tt-1KJGEOgY; Tue, 06 Feb 2018 13:01:20 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-1Ew8mSBu; Tue, 06 Feb 2018 13:01:14 +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: Tue, 6 Feb 2018 13:00:20 +0300 Message-Id: <1517911222-3896-6-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 5/7] example: instrum: configure instrumented API set X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Add configure time option to trim API set to be instrumented. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126978 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2768077ljc; Tue, 6 Feb 2018 02:09:31 -0800 (PST) X-Google-Smtp-Source: AH8x226lgqMcV47/xi8XBGQ++h2nGuSGB3gONq9wZbTcnejGsBGVlgN880eCFBrO2aGdmrqNTBnc X-Received: by 10.55.10.23 with SMTP id 23mr2504291qkk.93.1517911771259; Tue, 06 Feb 2018 02:09:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911771; cv=none; d=google.com; s=arc-20160816; b=f0dUyEvU+VRW2GkoHopNXGWbzM7+KD/nX+ekSDyL+2v2Qt6pMipRKf4s4s8azSZG7c TPnZgztDgDCmx8JsK8+ukaF9qHbwlAVSNUagtBMxWKPit+vcV9LYTITYQzMITxc29xe6 B375rB/By7J950uLzSIy/+69+tHWkKd8vZzWwOWYJqqvAv6gM0Os41o2e7JcVF9Hp+Vv di6sPPs2HEYFz7O6opp2j6WMkmZ+2wlrtnQwSonBHW3dfBBm7po7pz5/ii0M64/r+JzU b9h6i2fx7vevUcvK3NZxkzjfeDS0cBSf41Fxadh2zIxF+wiojml+neNRATzUNsCjBH8w suNQ== 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=o9iT4uq4VTiOtg50huu9b8VbCJyKoNLMHwV2x/eQFbQ=; b=XoBEPYBftTmS17stvaTr7jF0B8d7woUUff5yd3Dl6Qxnhkim+4h+zNL5JLlHeYYE0S b8kRCfOKJxczIOH+V3Zu6ASXJk5JhoOA5f1wgtNp0sM/dUGgjyJJ6sybjQXKVg7l4yIR wvvAUZsBmkrCg9zUAG1tyd4YhsI0+od5g4uCL2dpQ1ngx3+qFnrt2IgFgCEjL5cIiZqX Ru489KoQ9yjJK8r9b+xuvwa7DU+HcSlwMSDlQ4hZLZxVjaSOeqPQul7L88yGGDHQFuHZ ww9QY/SACuFimJD2y0oRUjiElTHgWN7W6vlxFZsTd2AE09IRL5fW7YdhtLXaAQvKJpkW 9VIQ== 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 m30si1743966qtk.225.2018.02.06.02.09.31; Tue, 06 Feb 2018 02:09:31 -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 EB8D861802; Tue, 6 Feb 2018 10:09:30 +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 8F10A619C0; Tue, 6 Feb 2018 10:04:08 +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 38AF162783; Tue, 6 Feb 2018 10:03:58 +0000 (UTC) Received: from forward102j.mail.yandex.net (forward102j.mail.yandex.net [5.45.198.243]) by lists.linaro.org (Postfix) with ESMTPS id 83497617D2 for ; Tue, 6 Feb 2018 10:01:28 +0000 (UTC) Received: from mxback6j.mail.yandex.net (mxback6j.mail.yandex.net [IPv6:2a02:6b8:0:1619::10f]) by forward102j.mail.yandex.net (Yandex) with ESMTP id 7FEE25601E25 for ; Tue, 6 Feb 2018 13:01:27 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback6j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id d4VjeVeUU0-1Rja2OX9; Tue, 06 Feb 2018 13:01:27 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-1KwWXwpb; Tue, 06 Feb 2018 13:01:20 +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: Tue, 6 Feb 2018 13:00:21 +0300 Message-Id: <1517911222-3896-7-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 6/7] example: instrum: update DEPENDENCIES X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Describe configuration and requirements of code instrumentation library. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ 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 Tue Feb 6 10: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: 126977 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2767520ljc; Tue, 6 Feb 2018 02:08:43 -0800 (PST) X-Google-Smtp-Source: AH8x224jdtMRLHfwRy4ZExEB6eCCwKA0UEjfpZsahybkQo6S34eUoZIrn3g71b7I755Cer8IwHnU X-Received: by 10.55.103.197 with SMTP id b188mr2678338qkc.244.1517911723551; Tue, 06 Feb 2018 02:08:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517911723; cv=none; d=google.com; s=arc-20160816; b=soRSs4CJmrpH6BcaDnfhzPRvoa0/ADWHWMKN07IGGXzH28sS8/dAmKyXPrHFOo0tFd Q14+yqs+vwBu6oXXI3ognarHWLCdHtq0KLVVFUH30kXRP8K5hAmISaIBulcXrXCHSaHM fhAi0bT7ru5+/drv8vwH+qyoibgmHGlyau86VcwcP4YtZ86tdPxxYNd8mvxXpocX8YG/ FoGb4AQCJZgSZqbr07LsVaCajwJ7kIhPqhDoe38RcTJEjUSxMiIKQ4tY7fsCejXWltbL OwYIkJgQlGQsaIZs93Y8GuWPj8bbRCzYfww4ECxxrGa0NIJFmrUPWegStw4mmVDCyQqz bIgw== 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=LAIHEdYP5RvAcEgO/R8gMFva6FeYYH/p5/AisvJpGjM=; b=cf7PMwk1gGABAUouNHJm/mKKAYgfKrXma8nTtGkID4vvwvx7HEexjHjuxPjlenBqpA gvpSKHvOfCTLXkZUJ0dqy+n3T5Yu1xhwzy4qFZg2WgA1rVYNHYLSXtT2VAW2HPKNBm6d 5MYZq6ZQ2asWdclAtgtCjq8zG6mjRIoMmvBfkth1Olsq0NA0g4xLHtUVLzZYbSFaqC1m RcXVAuDnsM3HrZW0Lit5kzlBYC7UPphAstcM9aCxZPkzbEFiWqfxyMNNmUGoQOgHlYo+ qxON74V97j9SxXxapxRpJc6lISyfnA8l0rvux4WMS7dm5d1UVCRGw75l0B9H8chWND45 ZD/g== 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 q42si1723686qtc.164.2018.02.06.02.08.43; Tue, 06 Feb 2018 02:08:43 -0800 (PST) Received-SPF: pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) client-ip=54.197.127.237; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lng-odp-bounces@lists.linaro.org designates 54.197.127.237 as permitted sender) smtp.mailfrom=lng-odp-bounces@lists.linaro.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=yandex.ru Received: by lists.linaro.org (Postfix, from userid 109) id 367356276F; Tue, 6 Feb 2018 10:08:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on ip-10-142-244-252 X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2 autolearn=disabled version=3.4.0 Received: from [127.0.0.1] (localhost [127.0.0.1]) by lists.linaro.org (Postfix) with ESMTP id F28C6617F1; Tue, 6 Feb 2018 10:03:57 +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 7171861784; Tue, 6 Feb 2018 10:03:53 +0000 (UTC) Received: from forward104j.mail.yandex.net (forward104j.mail.yandex.net [5.45.198.247]) by lists.linaro.org (Postfix) with ESMTPS id C1222607A2 for ; Tue, 6 Feb 2018 10:01:35 +0000 (UTC) Received: from mxback15j.mail.yandex.net (mxback15j.mail.yandex.net [IPv6:2a02:6b8:0:1619::91]) by forward104j.mail.yandex.net (Yandex) with ESMTP id 6BA51419BC for ; Tue, 6 Feb 2018 13:01:34 +0300 (MSK) Received: from smtp2p.mail.yandex.net (smtp2p.mail.yandex.net [2a02:6b8:0:1472:2741:0:8b6:7]) by mxback15j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id XaQutBxBav-1Y34fPOE; Tue, 06 Feb 2018 13:01:34 +0300 Received: by smtp2p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id bzfBbjnfEh-1RwWEO6a; Tue, 06 Feb 2018 13:01:27 +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: Tue, 6 Feb 2018 13:00:22 +0300 Message-Id: <1517911222-3896-8-git-send-email-odpbot@yandex.ru> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> References: <1517911222-3896-1-git-send-email-odpbot@yandex.ru> Github-pr-num: 443 Subject: [lng-odp] [PATCH v4 7/7] example: instrum: add travis test X-BeenThere: lng-odp@lists.linaro.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: "The OpenDataPlane \(ODP\) List" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: lng-odp-bounces@lists.linaro.org Sender: "lng-odp" From: Bogdan Pricope Add test to validate ODP build with papi library. Signed-off-by: Bogdan Pricope --- /** Email created from pull request 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: 34bd4730244cef8aa4ef2778135e469012c66768 **/ .travis.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/.travis.yml b/.travis.yml index e36c7bcb2..4a60f077a 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 --enable-code-instrum PAPI_CFLAGS="-I$HOME/papi-install/include" PAPI_LIBS="-L$HOME/papi-install/lib -lpapi" + - 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