[commit: ghc] ghc-8.0: Close ticky profiling file stream after printing (#9405) (803cbd8)
git at git.haskell.org
git at git.haskell.org
Thu Mar 24 21:59:55 UTC 2016
Repository : ssh://git@git.haskell.org/ghc
On branch : ghc-8.0
Link : http://ghc.haskell.org/trac/ghc/changeset/803cbd8b02b7f33f0c464321cde0e3a810562ba0/ghc
>---------------------------------------------------------------
commit 803cbd8b02b7f33f0c464321cde0e3a810562ba0
Author: Flaviu Andrei Csernik <fcsernik at gmail.com>
Date: Wed Mar 23 16:18:11 2016 +0100
Close ticky profiling file stream after printing (#9405)
Test Plan: T9405
Reviewers: simonmar, austin, bgamari
Reviewed By: simonmar, bgamari
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D2008
GHC Trac Issues: #9405
(cherry picked from commit 2708c22b8c8a415446d963575c0396a038b43a93)
>---------------------------------------------------------------
803cbd8b02b7f33f0c464321cde0e3a810562ba0
rts/RtsFlags.c | 4 +++-
rts/RtsStartup.c | 3 +++
testsuite/tests/rts/Makefile | 9 +++++++++
testsuite/tests/rts/T9405.hs | 3 +++
testsuite/tests/rts/T9405.stdout | 3 +++
5 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/rts/RtsFlags.c b/rts/RtsFlags.c
index 46d1409..b497429 100644
--- a/rts/RtsFlags.c
+++ b/rts/RtsFlags.c
@@ -589,9 +589,11 @@ void setupRtsFlags (int *argc, char *argv[], RtsConfig rts_config)
if (RtsFlags.GcFlags.statsFile != NULL) {
initStatsFile (RtsFlags.GcFlags.statsFile);
}
+#ifdef TICKY_TICKY
if (RtsFlags.TickyFlags.tickyFile != NULL) {
- initStatsFile (RtsFlags.GcFlags.statsFile);
+ initStatsFile (RtsFlags.TickyFlags.tickyFile);
}
+#endif
}
/* -----------------------------------------------------------------------------
diff --git a/rts/RtsStartup.c b/rts/RtsStartup.c
index bd6a6ae..4b9d947 100644
--- a/rts/RtsStartup.c
+++ b/rts/RtsStartup.c
@@ -408,6 +408,9 @@ hs_exit_(rtsBool wait_foreign)
#if defined(TICKY_TICKY)
if (RtsFlags.TickyFlags.showTickyStats) PrintTickyInfo();
+
+ FILE *tf = RtsFlags.TickyFlags.tickyFile;
+ if (tf != NULL) fclose(tf);
#endif
#if defined(mingw32_HOST_OS) && !defined(THREADED_RTS)
diff --git a/testsuite/tests/rts/Makefile b/testsuite/tests/rts/Makefile
index 52de19c..02255a6 100644
--- a/testsuite/tests/rts/Makefile
+++ b/testsuite/tests/rts/Makefile
@@ -45,6 +45,15 @@ T5423:
"$(TEST_HC)" $(TEST_HC_OPTS) -v0 T5423.o T5423_cmm.o -o T5423$(exeext)
./T5423
+.PHONY: T9405
+T9405:
+ @'$(TEST_HC)' $(TEST_HC_OPTS) -ticky -rtsopts T9405.hs; \
+ ./T9405 +RTS -rT9405.ticky & \
+ sleep 0.2; \
+ kill -2 $$!; \
+ wait $$!; \
+ [ -s T9405.ticky ] && echo Ticky-Ticky
+
# Naming convention: 'T5423_' obj-way '_' obj-src
# obj-way ::= v | dyn
# obj-src ::= gcc // using __attribute__(constructor)
diff --git a/testsuite/tests/rts/T9405.hs b/testsuite/tests/rts/T9405.hs
new file mode 100644
index 0000000..ca68e10
--- /dev/null
+++ b/testsuite/tests/rts/T9405.hs
@@ -0,0 +1,3 @@
+import Control.Concurrent
+
+main = threadDelay 2000000
diff --git a/testsuite/tests/rts/T9405.stdout b/testsuite/tests/rts/T9405.stdout
new file mode 100644
index 0000000..a62f1c2
--- /dev/null
+++ b/testsuite/tests/rts/T9405.stdout
@@ -0,0 +1,3 @@
+[1 of 1] Compiling Main ( T9405.hs, T9405.o )
+Linking T9405 ...
+Ticky-Ticky
More information about the ghc-commits
mailing list