[PATCH 4/5] perf test java symbol: Fix a false negative in symbol regex

Ilya Leoshkevich posted 5 patches 1 month, 1 week ago
[PATCH 4/5] perf test java symbol: Fix a false negative in symbol regex
Posted by Ilya Leoshkevich 1 month, 1 week ago
There are a lot of symbols like InterpreterRuntime::resolve_get_put()
in the perf report output, so the existing regex unfortunately always
matches something. Replace it with a more precise one.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
---
 tools/perf/tests/shell/test_java_symbol.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/tests/shell/test_java_symbol.sh b/tools/perf/tests/shell/test_java_symbol.sh
index f36c9321568c5..4c6bc57b87181 100755
--- a/tools/perf/tests/shell/test_java_symbol.sh
+++ b/tools/perf/tests/shell/test_java_symbol.sh
@@ -55,8 +55,10 @@ 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)
+# Look for them, while avoiding false positives from lines like this:
+#   0.03%  jshell           libjvm.so             [.] InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)
 perf report --stdio -i "$PERF_INJ_DATA" 2>&1 |
-	grep -E " +[0-9]+\.[0-9]+% .* (Interpreter|jdk\.internal).*" >/dev/null 2>&1
+	grep ' jshell .* jitted-.*\.so .* \(Interpreter$\|jdk\.internal\)' &>/dev/null
 
 if [ $? -ne 0 ]; then
 	echo "Fail to find java symbols"
-- 
2.51.1
Re: [PATCH 4/5] perf test java symbol: Fix a false negative in symbol regex
Posted by Namhyung Kim 1 month, 1 week ago
On Wed, Nov 05, 2025 at 08:10:27PM +0100, Ilya Leoshkevich wrote:
> There are a lot of symbols like InterpreterRuntime::resolve_get_put()
> in the perf report output, so the existing regex unfortunately always
> matches something. Replace it with a more precise one.
> 
> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> ---
>  tools/perf/tests/shell/test_java_symbol.sh | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/tests/shell/test_java_symbol.sh b/tools/perf/tests/shell/test_java_symbol.sh
> index f36c9321568c5..4c6bc57b87181 100755
> --- a/tools/perf/tests/shell/test_java_symbol.sh
> +++ b/tools/perf/tests/shell/test_java_symbol.sh
> @@ -55,8 +55,10 @@ 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)
> +# Look for them, while avoiding false positives from lines like this:
> +#   0.03%  jshell           libjvm.so             [.] InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)
>  perf report --stdio -i "$PERF_INJ_DATA" 2>&1 |
> -	grep -E " +[0-9]+\.[0-9]+% .* (Interpreter|jdk\.internal).*" >/dev/null 2>&1
> +	grep ' jshell .* jitted-.*\.so .* \(Interpreter$\|jdk\.internal\)' &>/dev/null

Maybe 'jshell' part can go away as well.. but it's up to you. :)

Thanks,
Namhyung

>  
>  if [ $? -ne 0 ]; then
>  	echo "Fail to find java symbols"
> -- 
> 2.51.1
>
Re: [PATCH 4/5] perf test java symbol: Fix a false negative in symbol regex
Posted by Ilya Leoshkevich 1 month, 1 week ago
On Thu, 2025-11-06 at 18:08 -0800, Namhyung Kim wrote:
> On Wed, Nov 05, 2025 at 08:10:27PM +0100, Ilya Leoshkevich wrote:
> > There are a lot of symbols like
> > InterpreterRuntime::resolve_get_put()
> > in the perf report output, so the existing regex unfortunately
> > always
> > matches something. Replace it with a more precise one.
> > 
> > Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
> > ---
> >  tools/perf/tests/shell/test_java_symbol.sh | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/tools/perf/tests/shell/test_java_symbol.sh
> > b/tools/perf/tests/shell/test_java_symbol.sh
> > index f36c9321568c5..4c6bc57b87181 100755
> > --- a/tools/perf/tests/shell/test_java_symbol.sh
> > +++ b/tools/perf/tests/shell/test_java_symbol.sh
> > @@ -55,8 +55,10 @@ 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)
> > +# Look for them, while avoiding false positives from lines like
> > this:
> > +#   0.03%  jshell           libjvm.so             [.]
> > InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)
> >  perf report --stdio -i "$PERF_INJ_DATA" 2>&1 |
> > -	grep -E " +[0-9]+\.[0-9]+% .*
> > (Interpreter|jdk\.internal).*" >/dev/null 2>&1
> > +	grep ' jshell .* jitted-.*\.so .*
> > \(Interpreter$\|jdk\.internal\)' &>/dev/null
> 
> Maybe 'jshell' part can go away as well.. but it's up to you. :)
> 
> Thanks,
> Namhyung

You are right, jdk.internal stuff may appear in Thread-1, as one can
see in the existing example. I will drop jshell from the regex.

[...]
>