Git Product home page Git Product logo

Comments (6)

taiki-e avatar taiki-e commented on June 2, 2024

Looking at https://doc.rust-lang.org/rustc/instrument-coverage.html#running-the-instrumented-binary-to-generate-raw-coverage-profiling-data it seems like there are modes which consolidate the data into a few files. Notably %Nm looks very useful for this use case.

I'm not sure that will fix the problem. If you are using nextest you are already using it.

cargo-llvm-cov/src/main.rs

Lines 214 to 230 in e3dd19f

if is_nextest {
// https://github.com/taiki-e/cargo-llvm-cov/issues/258
// https://clang.llvm.org/docs/SourceBasedCodeCoverage.html#running-the-instrumented-program
// Select the number of threads that is the same as the one nextest uses by default here.
// https://github.com/nextest-rs/nextest/blob/c54694dfe7be016993983b5dedbcf2b50d4b1a6e/nextest-runner/src/config/test_threads.rs
// https://github.com/nextest-rs/nextest/blob/c54694dfe7be016993983b5dedbcf2b50d4b1a6e/nextest-runner/src/config/config_impl.rs#L30
// TODO: should we respect custom test-threads?
// - If the number of threads specified by the user is negative or
// less or equal to available cores, it should not really be a problem
// because it does not exceed the number of available cores.
// - Even if the number of threads specified by the user is greater than
// available cores, it is expected that the number of threads that can
// write simultaneously will not exceed the number of available cores.
llvm_profile_file_name.push_str(&format!(
"-%{}m",
std::thread::available_parallelism().map_or(1, usize::from)
));


From experience, my impression is that when there is a disk usage problem, it is easier to just free up disk space than to look for workarounds to reduce disk usage (taiki-e/portable-atomic@de87ecc, taiki-e/workflows@382d344).

from cargo-llvm-cov.

cwfitzgerald avatar cwfitzgerald commented on June 2, 2024

From experience, my impression is that when there is a disk usage problem, it is easier to just free up disk space than to look for workarounds to reduce disk usage

Unfortunately at the rate our test disk space are growing, that is only buying us a little time until we need to start using the larger github runners with more space.

I'm not sure that will fix the problem. If you are using nextest you are already using it.

Interesting - the idea I was thinking of was using {}-%{}m instead of {}-%p-%{}m so that as much re-use as possible happens. I wonder if the PID behavior on windows causes more usage than on linux/mac where we didn't hit this problem.

from cargo-llvm-cov.

taiki-e avatar taiki-e commented on June 2, 2024

the idea I was thinking of was using {}-%{}m instead of {}-%p-%{}m so that as much re-use as possible happens.

Ah, interesting.

I've implemented this in llvm-profile-file-name branch. Could you try to see if it works as expected?

cargo install cargo-llvm-cov --git https://github.com/taiki-e/cargo-llvm-cov --branch llvm-profile-file-name

LLVM_PROFILE_FILE_NAME='<name>.profraw' cargo llvm-cov ...

from cargo-llvm-cov.

cwfitzgerald avatar cwfitzgerald commented on June 2, 2024

Nice!

Using the default profile name, running wgpu's 1000 test, test suite on my windows machine results in: 14.3 GB of profraw files.

Using "wgpu-%8n.profraw" as the profile name, I get 26 (264MB) profraw files.

Using "wgpu-%n.profraw" as the profile name, I get 13 (125MB) profraw files. This == the amount of binaries we have in our test suite, meaning it won't scale up as we add more tests.

I built the reports from the various runs and they were completely identical. Additionally, changing the number of allowed profiles didn't seem to affect runtime at all, though we generally have longer running tests (4s each). Recorded on a 20 core machine.

This is a massive win for us, and completely eliminates the problem. I might actually suggest that the nextest default be {}-%Nm, as this feels like a much better default.

from cargo-llvm-cov.

cwfitzgerald avatar cwfitzgerald commented on June 2, 2024

Just tested with a subset of our tests which are very fast (<0.1s each) and the profile file name setting makes no difference in suite runtime.

from cargo-llvm-cov.

taiki-e avatar taiki-e commented on June 2, 2024

Published in v0.6.2. Thanks for testing this!

I might actually suggest that the nextest default be {}-%Nm, as this feels like a much better default.

Yeah, it would be preferable to do so if it would not affect the accuracy.

from cargo-llvm-cov.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.