Re: [m-users.] Grade for profiling

Volker Wysk <[email protected]>
Newsgroups gmane.comp.lang.mercury.general
Message-ID <[email protected]>
For the record (if someone stumbles into the same problem). With the help of
Julien I was able to find the solution.

A (Linux) kernel feature called "Address space layout randomization" (ASLR)
must be turned off, before running the program which is to be profiled. This
can be accomplished with this command:

sudo bash -c "echo 0 > /proc/sys/kernel/randomize_va_space"

Then you get the right names for most predicates.

You also need to run the program with an English locale. Set the LANG
environment variable to "C.UTF-8" or something like that. Otherwise, the
mprof program might quit with an error message, because numbers aren't
formatted right (point vs. comma in floating point numbers).

Cheers,
Volker

Am Dienstag, dem 21.03.2023 um 06:27 +0100 schrieb Volker Wysk:
> Am Dienstag, dem 21.03.2023 um 10:16 +1100 schrieb Julien Fischer:
> > Hi Volker,
> > 
> > On Mon, 20 Mar 2023, Volker Wysk wrote:
> > 
> > > Am Montag, dem 20.03.2023 um 13:17 +0100 schrieb Volker Wysk:
> > > > Am Montag, dem 20.03.2023 um 21:29 +1100 schrieb Julien Fischer:
> > > > > 
> > > > > On Mon, 20 Mar 2023, Volker Wysk wrote:
> > > > > 
> > > > > > Hi, Julien
> > > > > > 
> > > > > > Am Montag, dem 20.03.2023 um 09:40 +1100 schrieb Julien Fischer:
> > > > > > > Hi Volker,
> > > > > > > 
> > > > > > > On Sun, 19 Mar 2023, Volker Wysk wrote:
> > > > > > > 
> > > > > > > > I want to profile my program, but when using mprof, I get only lines like
> > > > > > > > this:
> > > > > > > > 
> > > > > > > >  0.0       0.00     0.00 49576032     0.00     0.00
> > > > > > > > unknown__140325205178080 [140]
> > > > > > > > 
> > > > > > > > All names begin with "unknown_...".
> > > > > > > > 
> > > > > > > > My guess is, that debug symbols must be compiled in. My profiling grade is
> > > > > > > > "asm_fast.gc.prof", so no debug symbols.
> > > > > > > 
> > > > > > > The .prof component should be all that is required for (time) profiling
> > > > > > > to work; there's no need for anything additional
> > > > > > 
> > > > > > So why are all the names "unknown__..."? It isn't usable this way...
> > > > > 
> > > > > If they are all "unknown__...", then something is wrong. The profiler
> > > > > builds a table of addresses to procedure names; if it can't find an
> > > > > entry for a given address in that table it outputs it as "unknown__...".
> > > > > When you run a program with profiling enabled, that table should be
> > > > > written to the file Prof.Decl. When you run your program, does the file
> > > > > Prof.Decl contain any entries?
> > > > 
> > > > Yes, it does. It's a megabyte big.
> > > 
> > > This is how I build my program:
> > > 
> > > mmc -j8 -E --make \
> > >    --grade asm_fast.gc.debug.stseg \
> > >    --output-compile-error-lines=200 \
> > >    --cflags "$(pkg-config --cflags glib-2.0)" \
> > >    --cflags "$(pkg-config --cflags mhash)" \
> > >    --ml colipa \
> > >    -lodbc -lpthread -ldl \
> > >    --cflag "-DMODBC_UNIX" --cflag "-DMODBC_MYSQL" \
> > >    `pkg-config --libs glib-2.0` \
> > >    `pkg-config --libs mhash` \
> > >    "$PROG"
> > 
> > The above doesn't specify a profiling grade, so it's presumably not
> > quite how you built it.  
> 
> You're right. When I build with profiling, the grade line is:
> 
>     --grade asm_fast.gc.prof --profiling \
> 
> > If you want to zip up and the profiling files
> > (Prof.Decl, Prof.Counts and Prof.CallPair) and email them to me
> > directly, I can take a further look.
> 
> On the way - thanks!
> 
> 
> Volker
> _______________________________________________
> users mailing list
> [email protected]
> https://lists.mercurylang.org/listinfo/users

_______________________________________________
users mailing list
[email protected]
https://lists.mercurylang.org/listinfo/users
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEE6QXGh82Ov3+2nrxp+K4ydFOsHoUFAmQZV+MACgkQ+K4ydFOs
HoW7MQ//Rv3tXxyJDKzyCru0oER+qSIUwvoEg+IDa710TJjQ7UzeBbgLGkz8ufwT
qzNlABUpjfL5Vz5wZipiUyRSX0Gx67nicS6YLkFPG5Xq1fzYddWKvC4Ie0k4Ury3
o/wzKmIEc23FapNvyZliv8pCXPgpFkuGaU1jPuAAmY27i+AN2HjMuvsDKhHIk6zC
2UJKJpB0RtrvGnslGC/DZyr8jXk8v+P7ALpVm9na4zDp1K2JF5GJ8tOR8OWHnHxj
4LDYJbjU5wj0DJs2J/S0z28HQJptLFCBuCkw3hqhcOtx8uWfol0Cvljr4tk41RI2
B8SVcheKNla8ch05v1DCYSOWUtGLppmkzunYu2OG/vRGAnu/sAB1YKU73kZXXiiT
J3KhiSJ1ECvjNLTT/q6Qd0CyuM/l1B+tk+2f0Jf3SpYgpeyAt0ZzO2iIWGAHBq+s
t7JQUYQ4KuzkyPy/CQ22O53Xx8Gnf5PSIW1W8X2x1B1p+fxCS4bw3ws0BrNkFni/
NXW2BekfU7mY8fU2MJKDc6hluS/k8OVUGcTLw9umH3t4uGtz6/PZ5DuKpgyRW2d4
UPLJpihF2VrzTTxFueKOVAMX2IRhTFi7zjm5+U/F+JwQbPyhWFj8z5FNrJDJnqqA
kytQEOxuZm9d7wmGxr/MIONoVEV0n5L35XmhUc/ZA/tjtISBC3Y=
=8ARs
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.