Giter VIP home page Giter VIP logo

Comments (21)

staticfloat avatar staticfloat commented on May 28, 2024 3

I don't know if this is helpful for anyone, but I was somewhat surprised to find out that trying to end profiling with CTRL-C (which is how I end most of my rust programs) doesn't seem to kill the instruments helper. I believe this is where the issue was stemming for me, I had to set --time-limit=N and use that to kill my server process rather than use a SIGINT, as I'm used to.

from cargo-instruments.

tatsuya6502 avatar tatsuya6502 commented on May 28, 2024 2

Hi @hartshorne

In my case, the time template works, but the alloc template fails.

I ran into the same problem. I am using Big Sur 11.6.1 (20G224) but the same Instruments version.

It worked after I manually unzipped the missing file and moved it to the right place. This seems a bug in Instruments. This Stack Overflow answer explains how to do that: https://stackoverflow.com/a/67991957/2239513

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

I'm going to needs macOS/Instruments versions in order to investigate this.

from cargo-instruments.

teymour-aldridge avatar teymour-aldridge commented on May 28, 2024

I'm on MacOS Catalina 10.15.6, using Instruments version 12.4.

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

Same, though I don't see the nil object error. Trace files just won't open.

Instruments: Version 11.3.1 (11C504)
Mac OSX 10.14.6 Mojave
cargo-instruments 0.4.1

Running cargo instruments -t time

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

i'm not able to reproduce on macos 10.15 with instruments 12.4.

my gut instinct here is that it's something like your binary is exiting too quickly, and there's no data generated or something?

I would see if you can generate a valid profile directly using the instruments CLI, like:

instruments -t "Time Profiler" -D out.trace ./target/debug/my_crate ARGS

and see if this produces a trace you can open?

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

Yes, that works. I can open that trace.

app_Time-Profiler_2021-08-16T14/03/05.trace -> Are the slashes valid characters in the file name?

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

good question, where did that file name come from?

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

I assumed cargo-instruments generates it...that's the filename in target/instruments when I run cargo instruments -t time. In your example for directly calling instruments, the file is (obviously) out.trace.

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

interesting, I expect names to be in the format TARGET_Time-Profiler_2021-08-17T09:28:47.trace.

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

I think historically colons are also not allowed. OSX sometimes swaps them, according to a brief search. That seems to be what I'm seeing.

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

interesting, this may be file system dependent? in any case I can patch to remove colons, thanks.

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

So it doesn't seem to be colons.

cross-posted from #47:

I'd love to figure out if this is a problem with specific projects, or if it's a problem with your environment, if you have a chance to try cargo instruments on some publicly available code that would be helpful.

If you don't have anything handy, something I just tested was one of the examples in piet:

git checkout https://github.com/linebender/piet.git
cd piet/piet-common
cargo instruments -t time --example=mondrian --features png

does this work for you?

from cargo-instruments.

teymour-aldridge avatar teymour-aldridge commented on May 28, 2024

does this work for you?

That example does work for me.

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

@teymour-aldridge is the project that is not working for you public?

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

Yeah that example works.

❯ cargo instruments -t time --example=mondrian --features png
    Finished dev [unoptimized + debuginfo] target(s) in 0.24s
   Profiling target/debug/examples/mondrian with template 'Time Profiler'
  Trace file target/instruments/mondrian_Time-Profiler_2021-08-17_133758-856.trace

I don't know what kind of app this is. Mine are both services that keep running, so for me, the last thing I see is the "Profiling" line, never the "Trace file" line. Maybe because my apps don't exit. And Instruments never opens.

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

oh, if your process never exits then instruments is just running forever. You can use the --time-limit argument to kill the process after some elapsed time.

If you want to actually attach to the process while it is running, you're better off doing that through the GUI Instruments.app.

from cargo-instruments.

ckoehler avatar ckoehler commented on May 28, 2024

Yep, which isn't super helpful, so I've been doing just that, running it from the GUI. So everything works as expected for me, then!

from cargo-instruments.

cmyr avatar cmyr commented on May 28, 2024

@teymour-aldridge Is your application also something that never terminates, or do you think you have a different problem?

from cargo-instruments.

hartshorne avatar hartshorne commented on May 28, 2024

In my case, the time template works, but the alloc template fails.

Here's the program:

use std::collections::BTreeSet;

fn main() {
    let mut s = BTreeSet::new();
    for i in 0..1000 {
        s.insert(i);
    }
}

The command:

cargo instruments -t alloc

Produces these errors:

Screen Shot 2021-09-30 at 2 26 14 PM

Screen Shot 2021-09-30 at 2 26 10 PM

Environment:

% xcode-select --version
xcode-select version 2384.
% cargo-instruments --version              
cargo-instruments 0.4.3

Instruments 13.0
Big Sur 11.6 (20G165)

Thanks!

from cargo-instruments.

ChurchTao avatar ChurchTao commented on May 28, 2024

I ran into the same problem.
But used shell cargo instruments -t Allocations --example my_example --time-limit 10000 --open to resolved it.

from cargo-instruments.

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.