Skip to content

Commit d67cb05

Browse files
author
Jan Rochel
authored
Merge pull request #166 from chrismamo1/profiling
Add profiling flag to the config script and make it the default behaviour
2 parents 3ced25f + b1d7567 commit d67cb05

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

Makefile.options

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ OPTDBG += -bin-annot
1313
endif
1414

1515
ifeq "$(PROFILING)" "YES"
16-
BYTEDBG := -p ${BYTEDBG}
16+
BYTEDBG := ${BYTEDBG}
1717
OPTDBG += -p
1818
endif
1919

configure

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ set_defaults () {
7777
enable_natdynlink=1
7878
enable_debug=1
7979
enable_annot=1
80+
enable_profiling=0
8081
with_sqlite=1
8182
with_pgsql=1
8283
with_camlzip=1
@@ -106,7 +107,7 @@ full_pwd=`pwd`
106107
## Option parsing
107108

108109
## Which options exist? eoptions for enable/disable, woptions for with/without:
109-
eoptions="debug annot natdynlink"
110+
eoptions="debug annot profiling natdynlink"
110111
woptions="pgsql sqlite dbm camlzip"
111112

112113
print_options () {
@@ -181,6 +182,7 @@ usage: ./configure [ options ]
181182
182183
--enable-debug, --disable-debug Enable/disable debug output
183184
--enable-annot, --disable-annot Enable/disable .cmt{,i} files generation
185+
--enable-profiling, --disable-profiling Enable/disable profiling
184186
--enable-natdynlink, --disable-natdynlink Enable/disable nativecode dynamic linking
185187
186188
--with-sqlite, --without-sqlite Compile ocsipersist with SQLite for persistent storage
@@ -491,6 +493,11 @@ if [ $enable_annot -gt 0 ] ; then
491493
else
492494
enable_annot="NO"
493495
fi
496+
if [ $enable_profiling -gt 0 ] ; then
497+
enable_profiling="YES"
498+
else
499+
enable_profiling="NO"
500+
fi
494501
if [ $enable_natdynlink -gt 0 ] ; then
495502
enable_natdynlink="YES"
496503
else
@@ -574,7 +581,7 @@ DEBUG:=$enable_debug
574581
ANNOT:=$enable_annot
575582
576583
# Profiling (always put NO here - but if you want to debug ocsigen):
577-
PROFILING:=NO
584+
PROFILING:=$enable_profiling
578585
579586
580587

opam

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ build: [
1313
[
1414
"sh"
1515
"configure"
16+
"--enable-profiling"
1617
"--prefix"
1718
"%{prefix}%"
1819
"--ocsigen-user"

src/server/ocsigen_server.ml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@ let () = Ocsigen_commandline.cmdline
4747
an exception ... *)
4848
let _ = Sys.set_signal Sys.sigpipe Sys.Signal_ignore
4949

50+
(* Exit gracefully on SIGINT so that profiling will work *)
51+
let _ = Sys.set_signal Sys.sigint (Sys.Signal_handle(fun _ -> exit 0))
52+
5053
let section = Lwt_log.Section.make "ocsigen:main"
5154

5255
(* Initialize exception handler for Lwt timeouts: *)

0 commit comments

Comments
 (0)