Create core dump on purpose in C/C++? [duplicate] - c++

This question already has answers here:
How to programmatically cause a core dump in C/C++
(10 answers)
I want a function in C on linux to collect core dump without terminating the process
(4 answers)
Closed 5 years ago.
I would like to create a core dump in my application on purpose, not only when it gets terminated.
I don't know if this is the right question, but is there any kernel function to call in my program like dump_core("core.XXXX")?
The goal I want to achieve is, to dump my core on some points in my application and later to debug this core dumps with gdb.

Related

how to convert an executable file into a c++ file to peak at code [duplicate]

This question already has answers here:
Getting source from object file
(5 answers)
Closed 4 years ago.
I have an executable file, which was developed in c++. How do I convert it back into c++? I am unsure where to start. I am trying to edit a game, so that the ai makes decisions faster.
Just to add, you can't but you can disassemble it. With OllyDBG or IDA pro... You have to have a good grasp of Assembly language.
Then debug the game.... And watch the registers and watch what instructions make the game slow.

How could I know how much CPU time is used by all threads? [duplicate]

This question already has answers here:
How to determine CPU and memory consumption from inside a process
(10 answers)
Closed 7 years ago.
I have a few threads in my program - run on Windows and write in C++.
How can I know in the end of the running how much CPU time is used by all or one of them?
You can use the GetThreadTimes function: https://msdn.microsoft.com/en-us/library/windows/desktop/ms683237%28v=vs.85%29.aspx

How to get the RAM memory size programmatically [duplicate]

This question already has answers here:
Getting memory information with Qt
(3 answers)
How to get memory usage at runtime using C++?
(11 answers)
Closed 8 years ago.
I am looking for a way to retrieve the RAM memory size of my computer in C++ with Qt.
My primary target is Windows, if that would make things easier.

Get memory and CPU usage using PID? [duplicate]

This question already has answers here:
How to get memory usage under Windows in C++
(5 answers)
Closed 9 years ago.
Under windows, given a PID:
1) How to get the exact memory in bytes and
2) The exact CPU usage
consumed by that application right now?
See GetProcessMemoryInfo, and specifically the WorkingSetSize field of the out parameter.
GetProcessTimes will let you know how much time your process has spent altogether in user & kernel space. It's up to you to calculate percentages, or whatever you want out of it.

WIN 32 API to detect launched and terminated application/process [duplicate]

This question already has answers here:
How to detect win32 process creation/termination in c++
(9 answers)
Closed 9 years ago.
I am looking for a WIN 32 API to detect application launch and termination in my application.
I am looking to develop a dockBar/TaskBar for which I need to get handle of application that are launch and terminate.
For a DockBar/TaskBar have a look at the RegisterShellHookWindow function.
Specifically, the HSHELL_WINDOWCREATED and HSHELL_WINDOWDESTROYED notification.