Commit 675f65b7 authored by Iustin Pop's avatar Iustin Pop

Fix profiling targets

As noted by Guido, there are problems when using the hs-prof and
hs-prof-quick targets in the default configuration (compiling all
programs). The errors manifest in the form of wrong symbols during
compilation.

I knew that the hs-prof targets, which compiled multiple objects with
the '.o' suffix, could be problematic; but the objects that are
actually needed in the Template Haskell phase are very standard and
don't differ between the binaries (Constants, BasicTypes, JSON,
THH). What I didn't realise (although it's obvious) is that also the
hs_prof_quick targets (the final binaries) are also compiled with a
single suffix ('.prof_o'), which means that the object files are
actually compiled for the last binary.

This means that targets later in the HS_ALL_PROGS list would work
correct, but early targets, especially htools/htools, would fail.

So the obvious, and the single simple solution is to make these two
rules only work on a single binary at a time. This should be fine,
since one is looking at a specific problem usually, and it has the
advantage that the hs-prof step is much faster (since it wasn't
buildable in parallel anyway).

Thanks to Guido for finding and making the initial diagnose on this!
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0d57ce24
......@@ -692,13 +692,21 @@ htest/offline-tests.sh: htest/hpc-htools htest/hpc-mon-collector
# run before)
.PHONY: hs-prof hs-prof-quick
hs-prof:
@if [ -z "$(TARGET)" ]; then \
echo "You need to define TARGET when running this rule" 1>&2; \
exit 1; \
fi
$(MAKE) $(AM_MAKEFLAGS) clean
$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf o"
$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf o"
rm -f $(HS_ALL_PROGS)
$(MAKE) $(AM_MAKEFLAGS) hs-prof-quick
hs-prof-quick:
$(MAKE) $(AM_MAKEFLAGS) $(HS_ALL_PROGS) HEXTRA="-osuf prof_o -prof -auto-all"
@if [ -z "$(TARGET)" ]; then \
echo "You need to define TARGET when running this rule" 1>&2; \
exit 1; \
fi
$(MAKE) $(AM_MAKEFLAGS) $(TARGET) HEXTRA="-osuf prof_o -prof -auto-all"
dist_sbin_SCRIPTS = \
tools/ganeti-listrunner
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment