Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp13273rwb; Fri, 12 Aug 2022 13:18:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR4Hr/WVmhlZMzeK3ruWAa+9aullY/aDAeWhw4hx8Ny/86KiE/ypewjJaW3woDo51rXArbjM X-Received: by 2002:a17:906:8a53:b0:730:b81c:138 with SMTP id gx19-20020a1709068a5300b00730b81c0138mr3605047ejc.114.1660335537702; Fri, 12 Aug 2022 13:18:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660335537; cv=none; d=google.com; s=arc-20160816; b=vtaDxLBy+2c2g7J9DRva6+ZWLY3yGDMU/EfUEoPEfpLlCsBrGWl+5NkuoqAPWYNZrb keY3Aqe6ujE/1qgNwf3sRlfoQfn6QzvZwEJVr89Ar91arOBkWv6zYHEuD2U6BdSdqr1M yYUxGUwov9w0wAQvHM3ELtqvaTCXqsP8rboUrqezikyh3eDyz/wJVz7553bDtWImQQcW YVVf9FbzSiZE7sS7UpZ8B4C8yCp7+bxrJ9ihXFX/cwKhnUGFqXEBr/QfikTpmelHg71x hsSb2tlujPXndEhBSq01GW8Eaje5L2CXDM9TTODgQ1iDOb9feBmSu8XSlm+mzCSNoW4j HCPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dp7MEd3M9Ypu40le1/XEQK+rLylgcHGwDAZpxPFDKv8=; b=cien+/an1x935d9TES9HEEOtGlXaHT3/t7sEack7dZrCVXTKSj/hDV7HWP6TNUbfyl TyGJom1qgpOg1jLLR12LjWw8l6QVyiBtDIilfmLk8pVc6PzVnVwRCSPq1NHjG8yt/LZD hWkq3tU0PCoPGG/AF4vzzMPubfR0X+snEnU/aJpjfo1Xa0fIy04NjDpJGVofy90ESacK r0XNofUHBGI6iPMMX89RPPJAD74aFNy1hL/ryZNxO3lRp/2um1sX+uu4Zuu5sc8+g0Kr j4viC978uFGdaUNFfvaHiJvy4gPiTqBQ+M6KDTkvNBtms4dLeu7jxaG34QWUDooTmM/o U1uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h8rwd8Nd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020a1709064fcd00b00734bbe8d2f7si2628848ejw.952.2022.08.12.13.18.31; Fri, 12 Aug 2022 13:18:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=h8rwd8Nd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238115AbiHLTrt (ORCPT + 99 others); Fri, 12 Aug 2022 15:47:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230433AbiHLTrr (ORCPT ); Fri, 12 Aug 2022 15:47:47 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0049BB3B0A; Fri, 12 Aug 2022 12:47:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7BD12617D0; Fri, 12 Aug 2022 19:47:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B66EAC433D6; Fri, 12 Aug 2022 19:47:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660333665; bh=sLwV+GfE5JlpxI6fGKXia79sYL3aNd8bTMsFSGrZUMk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=h8rwd8NdYRL7FXj7T2VnfGlYsburhFeYY59+RumlqhM+U5jny6jvfNmoIEumJyl+a qhfk8HzlOYttknjvbDoY9NS+f+So3V8mxdVytNdD3Dlw0yPDHhEWSblN6VEEC/pM4v J3hS87H3VD+p+WAcFoHN6fREEOYh+0uQraoSmeKbme/9HgKX1JN19Gcx0pj5hxa9au O6N/NpfztNDNBioSDvFrRy0XQvTx7SrfseIR5TiYUTHr/EHRfG7r5Cb82XefrdDbFZ p6RDYyRvz6SqcwXIdsTRY5d2X81N3ZHcv5UurNOAEGd8rnNyk0o0tJFi4bJrV1skDp F/20I7PiewWcA== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id E07E34035A; Fri, 12 Aug 2022 16:47:43 -0300 (-03) Date: Fri, 12 Aug 2022 16:47:43 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: Ian Rogers , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Subject: Re: [PATCH 2/2] perf test: Introduce script for java symbol testing Message-ID: References: <20220806033434.121908-1-leo.yan@linaro.org> <20220806033434.121908-3-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220806033434.121908-3-leo.yan@linaro.org> X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Sat, Aug 06, 2022 at 11:34:34AM +0800, Leo Yan escreveu: > This commit introduces a script for testing java symbols. > > The test records for java program, inject samples with JIT samples, then > check specific words "Interpreter" and "jdk.internal" in the report, the > test will pass if these two symbols are detected. > > Signed-off-by: Leo Yan > --- > tools/perf/tests/shell/test_java_symbol.sh | 66 ++++++++++++++++++++++ > 1 file changed, 66 insertions(+) > create mode 100755 tools/perf/tests/shell/test_java_symbol.sh > > diff --git a/tools/perf/tests/shell/test_java_symbol.sh b/tools/perf/tests/shell/test_java_symbol.sh > new file mode 100755 > index 000000000000..45d42a9fdca5 > --- /dev/null > +++ b/tools/perf/tests/shell/test_java_symbol.sh > @@ -0,0 +1,66 @@ > +#!/bin/bash > +# Test java symbol > + > +# SPDX-License-Identifier: GPL-2.0 > +# Leo Yan , 2022 > + > +PERF_DATA=$(mktemp /tmp/__perf_test.perf.data.XXXXX) > +PERF_INJ_DATA=$(mktemp /tmp/__perf_test.perf.data.inj.XXXXX) > + > +cleanup_files() > +{ > + echo "Cleaning up files..." > + rm -f ${PERF_DATA} > + rm -f ${PERF_INJ_DATA} > +} > + > +trap cleanup_files exit term int > + > +if [ -e "$PWD/tools/perf/libperf-jvmti.so" ]; then > + LIBJVMTI=$PWD/tools/perf/libperf-jvmti.so Will this only work if we do a: make -C tools/perf ? > +elif [ -e "$PWD/libperf-jvmti.so" ]; then > + LIBJVMTI=$PWD/libperf-jvmti.so > +elif [ -e "$PREFIX/lib64/libperf-jvmti.so" ]; then > + LIBJVMTI=$PREFIX/lib64/libperf-jvmti.so > +elif [ -e "$PREFIX/lib/libperf-jvmti.so" ]; then > + LIBJVMTI=$PREFIX/lib/libperf-jvmti.so > +else > + echo "Fail to find libperf-jvmti.so" > + exit 1 > +fi > + > +cat < +int fib(int x) { > + return x > 1 ? fib(x - 2) + fib(x - 1) : 1; > +} > + > +int q = 0; > + > +for (int i = 0; i < 10; i++) > + q += fib(i); > + > +System.out.println(q); > +EOF > + > +if [ $? -ne 0 ]; then > + echo "Fail to record for java program" > + exit 1 > +fi > + > +if ! perf inject -i $PERF_DATA -o $PERF_INJ_DATA -j; then > + echo "Fail to inject samples" > + exit 1 > +fi > + > +# Below is an example of the instruction samples reporting: > +# 8.18% jshell jitted-50116-29.so [.] Interpreter > +# 0.75% Thread-1 jitted-83602-1670.so [.] jdk.internal.jimage.BasicImageReader.getString(int) > +perf report --stdio -i ${PERF_INJ_DATA} 2>&1 | \ > + egrep " +[0-9]+\.[0-9]+% .* (Interpreter|jdk\.internal).*" > /dev/null 2>&1 > + > +if [ $? -ne 0 ]; then > + echo "Fail to find java symbols" > + exit 1 > +fi > + > +exit 0 > -- > 2.25.1 -- - Arnaldo