Hi Steinar,

On  Do 03 Jan 2019 23:45:28 CET, Steinar H. Gunderson wrote:

Package: libjpeg62-turbo
Version: 1:1.5.2-2+b1
Severity: normal
Tags: patch upstream

Hi,

When profiling any program that uses libjpeg-turbo, there's a proliferation
of “symbols” that are really internal labels, confusing the profiler:

14,50% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_fdct_islow_sse2 8,80% MJPEG_Encode nageru [.] memcpy_interleaved_fastpath 8,69% MJPEG_Encode libjpeg.so.62.2.0 [.] ..@25..CHECKBUF47_END 4,51% MJPEG_Encode libc-2.28.so [.] __memmove_avx_unaligned_erms 3,81% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_quantize_sse2.quantloop
   3,24%  MJPEG_Encode     libjpeg.so.62.2.0              [.] encode_mcu_huff
2,81% Mixer_Audio libzita-resampler.so.1.6.0 [.] Resampler::process 2,54% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_convsamp_sse2.convloop 2,44% nageru [unknown] [k] 0xffffffffa280015f 2,31% MHD-connection [unknown] [k] 0xffffffffa280015f 2,09% MJPEG_Encode libjpeg.so.62.2.0 [.] ..@44..CHECKBUF31_END 2,02% QS_Encode [unknown] [k] 0xffffffffa280015f 1,98% Mixer_Audio libzita-resampler.so.1.6.0 [.] VResampler::process
   1,89%  MJPEG_Encode     libjpeg.so.62.2.0              [.] compress_data
1,57% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_huff_encode_one_block_sse2.BLOOP
   1,39%  MJPEG_Encode     libjpeg.so.62.2.0              [.] forward_DCT
1,21% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_huff_encode_one_block_sse2

Note in particular ..@25..CHECKBUF47_END, which is really part of
jsimd_huff_encode_one_block_sse2, and the same with .BLOOP. This is a known
shortcoming of nasm, but can be stripped out fairly easily, e.g., with
something like

--- libjpeg-turbo-1.5.2.orig/simd/nasm_lt.sh
+++ libjpeg-turbo-1.5.2/simd/nasm_lt.sh
@@ -39,6 +39,7 @@ while [ $# -gt 0 ]; do
         -o*)
             o_opt=yes
             command="$command $1"
+            outfile="$2"
             ;;
         *.asm)
             infile=$1
@@ -53,8 +54,11 @@ done
 if [ "$o_opt" != yes ] ; then
     # By default, NASM creates an output file
     # in the same directory as the input file.
-    outfile="-o `echo $infile | sed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.o"
-    command="$command $outfile"
+    outfile="`echo $infile | sed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.o"
+    command="$command -o $outfile"
 fi
+set -e
 echo $command
-exec $command
+$command
+echo strip --discard-locals --wildcard --strip-symbol='?*.*' $outfile
+strip --discard-locals --wildcard --strip-symbol='?*.*' $outfile

After applying said patch and rebuilding, the profile is a lot more readable
and less cluttered:

16,05% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_huff_encode_one_block_sse2 14,38% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_fdct_islow_sse2 8,50% MJPEG_Encode nageru [.] memcpy_interleaved_fastpath 4,75% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_quantize_sse2 3,71% MJPEG_Encode libc-2.28.so [.] __memmove_avx_unaligned_erms 3,11% MJPEG_Encode libjpeg.so.62.2.0 [.] jsimd_convsamp_sse2
   2,86%  MJPEG_Encode     libjpeg.so.62.2.0              [.] encode_mcu_huff

Backtracing and disassembling in gdb is also affected by this issue.

-- System Information:
Debian Release: buster/sid
  APT prefers testing-debug
  APT policy: (500, 'testing-debug'), (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.11 (SMP w/40 CPU cores)
Locale: LANG=en_DK.UTF-8, LC_CTYPE=en_DK.UTF-8 (charmap=UTF-8), LANGUAGE=en_NO:en_US:en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libjpeg62-turbo depends on:
ii  libc6  2.28-2

libjpeg62-turbo recommends no packages.

libjpeg62-turbo suggests no packages.

-- debconf-show failed


Sorry for replying so late. Could you bring this up with the upstream maintainers of libjpeg-turbo? I guess you can explain everything much better than me (as you probably had to work around the above problem).

I'd be happy to apply your patchl, if upstream accepts it.

Greets,
Mike
--

DAS-NETZWERKTEAM
c\o Technik- und Ökologiezentrum Eckernförde
Mike Gabriel, Marienthaler Str. 17, 24340 Eckernförde
mobile: +49 (1520) 1976 148
landline: +49 (4351) 850 8940

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabr...@das-netzwerkteam.de, http://das-netzwerkteam.de

Attachment: pgpIGex8EcTag.pgp
Description: Digitale PGP-Signatur

Reply via email to