www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - does dmd --build=profile-gc work with core.stdc.stdlib.exit()?

reply mw <mingwu gmail.com> writes:
Hi,

I'm mem-profiling a multi-threaded program, and want it to exit 
early, so I added a call
```
core.stdc.stdlib.exit(-1);
```

in a loop in one of the thread.

However when the program reached this point, it seems hang: it's 
not exiting, and CPU usage dropped to 0%.

I'm wondering does dmd --build=profile-gc work with 
core.stdc.stdlib.exit()?

And where is the output report file, and the filename? I didn't 
see any report file generated in the current working dir.

BTW, can --build=profile-gc can intercept "Ctrl+C" and generate 
*partial* report file?

And what's the suggested proper way to do early exit, and still 
let --build=profile-gc generate reports?

Thanks!
Nov 13 2022
parent reply mw <mingwu gmail.com> writes:
On Sunday, 13 November 2022 at 18:48:42 UTC, mw wrote:
 BTW, can --build=profile-gc can intercept "Ctrl+C" and generate 
 *partial* report file?

 And what's the suggested proper way to do early exit, and still 
 let --build=profile-gc generate reports?
I tried presss "Ctrl+C", and that cannot stop the program, it just hangs there. I have to `kill -9 <pid>` it to get it stopped.
Nov 13 2022
parent reply mw <mingwu gmail.com> writes:
On Sunday, 13 November 2022 at 18:51:17 UTC, mw wrote:
 On Sunday, 13 November 2022 at 18:48:42 UTC, mw wrote:
 BTW, can --build=profile-gc can intercept "Ctrl+C" and 
 generate *partial* report file?

 And what's the suggested proper way to do early exit, and 
 still let --build=profile-gc generate reports?
I tried presss "Ctrl+C", and that cannot stop the program, it just hangs there. I have to `kill -9 <pid>` it to get it stopped.
My build command is: ``` /dmd2/linux/bin64/dub build --build=profile-gc --config=... --compiler=dmd ```
Nov 13 2022
parent mw <mingwu gmail.com> writes:
On Sunday, 13 November 2022 at 19:02:29 UTC, mw wrote:
 BTW, can --build=profile-gc can intercept "Ctrl+C" and 
 generate *partial* report file?

 And what's the suggested proper way to do
Is there a profile-gc plugin function I can call in the middle of my program to generate *partial* report file?
Nov 13 2022