Skip to content

Commit 3c41333

Browse files
authored
Merge pull request #5760 from xapi-project/feature/perf
Merge feature/perf to master
2 parents 7279089 + e3d84de commit 3c41333

File tree

122 files changed

+5458
-185
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+5458
-185
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ _build/
22
*.bak
33
*.native
44
.merlin
5+
_coverage/
56
*.install
67
*.swp
78
compile_flags.txt

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ JOBS = $(shell getconf _NPROCESSORS_ONLN)
66
PROFILE=release
77
OPTMANDIR ?= $(OPTDIR)/man/man1/
88

9-
.PHONY: build clean test doc python format install uninstall
9+
.PHONY: build clean test doc python format install uninstall coverage
1010

1111
# if we have XAPI_VERSION set then set it in dune-project so we use that version number instead of the one obtained from git
1212
# this is typically used when we're not building from a git repo
@@ -20,6 +20,11 @@ build:
2020
check:
2121
dune build @check -j $(JOBS)
2222

23+
coverage:
24+
dune runtest --instrument-with bisect_ppx --force --profile=$(RELEASE) -j $(JOBS)
25+
bisect-ppx-report html
26+
bisect-ppx-report summary --per-file
27+
2328
clean:
2429
dune clean
2530

@@ -57,6 +62,7 @@ TEST_TIMEOUT=600
5762
TEST_TIMEOUT2=1200
5863
test:
5964
ulimit -S -t $(TEST_TIMEOUT); \
65+
ulimit -n 2048; \
6066
(sleep $(TEST_TIMEOUT) && ps -ewwlyF --forest)& \
6167
PSTREE_SLEEP_PID=$$!; \
6268
trap "kill $${PSTREE_SLEEP_PID}" INT TERM EXIT; \
@@ -206,6 +212,7 @@ install: build doc sdk doc-json
206212
install -D -m 755 _build/install/default/bin/xcp-rrdd-iostat $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/xcp-rrdd-iostat
207213
install -D -m 755 _build/install/default/bin/xcp-rrdd-squeezed $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/xcp-rrdd-squeezed
208214
install -D -m 755 _build/install/default/bin/xcp-rrdd-xenpm $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/xcp-rrdd-xenpm
215+
install -D -m 755 _build/install/default/bin/xcp-rrdd-dcmi $(DESTDIR)$(LIBEXECDIR)/xcp-rrdd-plugins/xcp-rrdd-dcmi
209216
install -D -m 644 ocaml/xcp-rrdd/bugtool-plugin/rrdd-plugins.xml $(DESTDIR)$(ETCXENDIR)/bugtool/xcp-rrdd-plugins.xml
210217
install -D -m 644 ocaml/xcp-rrdd/bugtool-plugin/rrdd-plugins/stuff.xml $(DESTDIR)$(ETCXENDIR)/bugtool/xcp-rrdd-plugins/stuff.xml
211218
install -D -m 755 ocaml/xcp-rrdd/bin/rrdp-scripts/sysconfig-rrdd-plugins $(DESTDIR)/etc/sysconfig/xcp-rrdd-plugins

dune-project

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
(formatting (enabled_for ocaml))
33
(using menhir 2.0)
44

5+
(cram enable)
6+
(implicit_transitive_deps false)
57
(generate_opam_files true)
68

79
(name "xapi")
@@ -559,6 +561,8 @@ This package provides an Lwt compatible interface to the library.")
559561
base-unix
560562
(odoc :with-doc)
561563
(xapi-stdext-pervasives (= :version))
564+
(mtime :with-test)
565+
(xapi-stdext-unix (= :version))
562566
)
563567
)
564568

@@ -568,12 +572,19 @@ This package provides an Lwt compatible interface to the library.")
568572
(authors "Jonathan Ludlam")
569573
(depends
570574
(ocaml (>= 4.12.0))
575+
(alcotest :with-test)
571576
base-unix
577+
(bisect_ppx :with-test)
572578
(fd-send-recv (>= 2.0.0))
579+
fmt
580+
(mtime (and (>= 2.0.0) :with-test))
581+
(logs :with-test)
582+
(qcheck-core (and (>= 0.21.2) :with-test))
573583
(odoc :with-doc)
574584
xapi-backtrace
575585
unix-errno
576586
(xapi-stdext-pervasives (= :version))
587+
polly
577588
)
578589
)
579590

ocaml/database/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
xapi-datamodel
4242
xapi-log
4343
(re_export xapi-schema)
44+
xapi-idl.updates
4445
xapi-stdext-encodings
4546
xapi-stdext-pervasives
4647
xapi-stdext-std

ocaml/database/master_connection.ml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ let do_db_xml_rpc_persistent_with_reopen ~host:_ ~path (req : string) :
271271
!Db_globs.permanent_master_failure_retry_interval ;
272272
Thread.delay !Db_globs.permanent_master_failure_retry_interval ;
273273
!Db_globs.restart_fn ()
274-
| e -> (
274+
| e ->
275275
error "Caught %s" (Printexc.to_string e) ;
276276
(* RPC failed - there's no way we can recover from this so try reopening connection every 2s + backoff delay *)
277277
( match !my_connection with
@@ -322,9 +322,7 @@ let do_db_xml_rpc_persistent_with_reopen ~host:_ ~path (req : string) :
322322
debug "%s: Sleep interrupted, retrying master connection now"
323323
__FUNCTION__ ;
324324
update_backoff_delay () ;
325-
try open_secure_connection () with _ -> ()
326-
(* oh well, maybe nextime... *)
327-
)
325+
D.log_and_ignore_exn open_secure_connection
328326
done ;
329327
!result
330328

ocaml/database/redo_log.ml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -642,7 +642,8 @@ let startup log =
642642
) ;
643643
match !(log.device) with
644644
| None ->
645-
D.info "Could not find block device"
645+
D.info "Could not find block device" ;
646+
broken log
646647
| Some device ->
647648
D.info "Using block device at %s" device ;
648649
(* Check that the block device exists *)

ocaml/forkexecd/lib/dune

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
fd-send-recv
88
rpclib.core
99
rpclib.json
10+
rpclib.xml
1011
uuid
1112
xapi-backtrace
1213
xapi-log

ocaml/forkexecd/test/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(executable
22
(modes exe)
33
(name fe_test)
4-
(libraries forkexec uuid xapi-stdext-unix))
4+
(libraries forkexec uuid xapi-stdext-unix fd-send-recv))
55

66
(rule
77
(alias runtest)

ocaml/idl/ocaml_backend/gen_api.ml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,19 @@ let gen_non_record_type tys =
112112
t
113113
| ty :: t ->
114114
let alias = OU.alias_of_ty ty in
115+
let accu =
116+
match ty with
117+
| DT.Enum (name, cs) ->
118+
sprintf "let all_%s = [%s]" name
119+
(cs
120+
|> List.map fst
121+
|> List.map OU.constructor_of
122+
|> String.concat "; "
123+
)
124+
:: accu
125+
| _ ->
126+
accu
127+
in
115128
if List.mem_assoc alias overrides then
116129
aux
117130
(sprintf "type %s = %s\n%s\n" alias (OU.ocaml_of_ty ty)

ocaml/libs/clock/dune

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@
1616
(names test_date test_timer)
1717
(package clock)
1818
(modules test_date test_timer)
19-
(libraries alcotest clock fmt mtime ptime qcheck-core qcheck-core.runner)
19+
(libraries alcotest clock fmt mtime mtime.clock.os ptime qcheck-core qcheck-core.runner)
2020
)

0 commit comments

Comments
 (0)