Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a stats module to record resource usage #1543

Merged
1 commit merged into from Nov 19, 2018
Merged

Add a stats module to record resource usage #1543

1 commit merged into from Nov 19, 2018

Conversation

ghost
Copy link

@ghost ghost commented Nov 15, 2018

This PR adds a Stats module to record resource usage as well as a --stats command line option to enable stats recording and printing. Currently, only the number of open file descriptors is recorded, though we could record more in the future such as memory usage.

Stats are collected in the scheduler, just before waiting for the next event. I tired it for building dune itself:

$ dune build --stats
Stats:                   
max opened fds: 241
$ dune clean
$ dune build -j1 --stats
Stats:                   
max opened fds: 241

It seems like we could do a bit better on this front. The reason we have so many open file descriptors is because dune starts all the internal jobs it can, and then they all block on the scheduler waiting for a slot to run external processes.

@ghost ghost requested review from emillon and rgrinberg as code owners November 15, 2018 08:39
@emillon
Copy link
Collaborator

emillon commented Nov 16, 2018

Does this have any performance implications when it's active?

@ghost
Copy link
Author

ghost commented Nov 19, 2018

I suppose yh, though it's probably small.

Signed-off-by: Jeremie Dimino <jeremie@dimino.org>
@ghost ghost merged commit 19893f7 into ocaml:master Nov 19, 2018
rgrinberg added a commit to rgrinberg/opam-repository that referenced this pull request Nov 29, 2018
CHANGES:

- Expand variables in `install` stanzas (ocaml/dune#1354, @mseri)

- Add predicate language support for specifying sub directories. This allows the
  use globs, set operations, and special values in specifying the sub
  directories used for the build. For example: `(dirs :standard \ lib*)` will
  use all directories except those that start with `lib`. (ocaml/dune#1517, ocaml/dune#1568,
  @rgrinberg)

- Add `binaries` field to the `(env ..)` stanza. This field sets and overrides
  binaries for rules defined in a directory. (ocaml/dune#1521, @rgrinberg)

- Fix a crash caused by using an extension in a project without
  dune-project file (ocaml/dune#1535, fix ocaml/dune#1529, @diml)

- Allow `%{bin:..}`, `%{exe:..}`, and other static expansions in the `deps`
  field. (ocaml/dune#1155, fix ocaml/dune#1531, @rgrinberg)

- Fix bad interaction between on-demand ppx rewriters and using multiple build
  contexts (ocaml/dune#1545, @diml)

- Fix handling of installed .dune files when the backend is declared via a
  `dune` file (ocaml/dune#1551, fixes ocaml/dune#1549, @diml)

- Add a `--stats` command line option to record resource usage (ocaml/dune#1543, @diml)

- Fix `dune build @doc` deleting `highlight.pack.js` on rebuilds, after the
  first build (ocaml/dune#1557, @aantron).

- Allow targets to be directories, which Dune will treat opaquely
  (ocaml/dune#1547, @jordwalke)

- Support for OCaml 4.08: `List.t` is now provided by OCaml (ocaml/dune#1561, @ejgallego)

- Exclude the local esy directory (`_esy`) from the list of watched directories
  (ocaml/dune#1578, @andreypopp)

- Fix the output of `dune external-lib-deps` (ocaml/dune#1594, @diml)

- Introduce `data_only_dirs` to replace `ignored_subdirs`. `ignored_subdirs` is
  deprecated since 1.6. (ocaml/dune#1590, @rgrinberg)
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants