|
Adaptyst
A comprehensive and architecture-agnostic performance analysis tool
|
#include <process.hpp>
Classes | |
| class | EmptyCommandException |
| class | NotImplementedException |
| class | NotNotifiableException |
| class | NotReadableException |
| class | NotStartedException |
| class | NotWritableException |
| class | StartException |
| class | WaitException |
Public Member Functions | |
| Process (std::function< int()> command, unsigned int buf_size=1024) | |
| Process (std::vector< std::string > &command, unsigned int buf_size=1024) | |
| ~Process () | |
| void | add_env (std::string key, std::string value) |
| void | set_redirect_stdout (fs::path path) |
| void | set_redirect_stdout_to_terminal () |
| void | set_redirect_stdout (Process &process) |
| void | set_redirect_stderr (fs::path path) |
| int | start (bool wait_for_notify, const CPUConfig &cpu_config, bool is_profiler, fs::path working_path=fs::current_path()) |
| int | start (fs::path working_path=fs::current_path()) |
| void | notify () |
| std::string | read_line () |
| void | write_stdin (char *buf, unsigned int size) |
| int | join () |
| bool | is_running () |
| void | close_stdin () |
| void | terminate () |
Static Public Attributes | |
| static const int | ERROR_START = 200 |
| static const int | ERROR_STDOUT = 201 |
| static const int | ERROR_STDERR = 202 |
| static const int | ERROR_STDOUT_DUP2 = 203 |
| static const int | ERROR_STDERR_DUP2 = 204 |
| static const int | ERROR_AFFINITY = 205 |
| static const int | ERROR_STDIN_DUP2 = 206 |
| static const int | ERROR_NOT_FOUND = 207 |
| static const int | ERROR_NO_ACCESS = 208 |
| static const int | ERROR_SETENV = 209 |
| static const int | ERROR_ABNORMAL_EXIT = 210 |
This class represents an arbitrary code running in a separate program process.
|
inline |
Constructs a Process object.
| command | Function returning an exit code to execute in a separate process. |
| buf_size | Internal buffer size in bytes. |
|
inline |
Constructs a Process object.
| command | Shell command to execute in a separate process. |
| buf_size | Internal buffer size in bytes. |
|
inline |
|
inline |
Adds an environment variable in form of a key-value pair.
| key | Environment variable key. |
| value | Environment variable value. |
|
inline |
Closes stdin for writing. This is equivalent to sending EOF to stdin.
|
inline |
Returns whether the process is currently running.
|
inline |
Waits for the process to finish executing.
|
inline |
Notifies the process that it can start. Relevant when start() has been called with wait_for_notify set to true.
|
inline |
Reads a line from stdout.
|
inline |
Redirects stderr to a specified file.
| path | Path to a stderr file. |
|
inline |
Redirects stdout to a specified file.
| path | Path to a stdout file. |
|
inline |
Redirects stdout to another process.
| process | Process to pipe stdout to. |
|
inline |
Redirects stdout to the terminal.
|
inline |
Spawns a new process executing a code or command specified in the constructor and returns the ID of the process immediately.
| wait_for_notify | Indicates whether the process should wait for a notification before executing. If true, the notification should be sent via notify(). |
| cpu_config | CPU core configuration for the process. |
| is_analysis | Whether the process corresponds to performance analysis (this is important in the context of cpu_config). |
| working_path | Working directory of the process. |
|
inline |
Spawns a new process executing a code or command specified in the constructor and returns the ID of the process immediately, with a simplified set of arguments (no notification, no specific CPU core configuration, no indication of the process as a performance-analysis-related one).
| working_path | Working directory of the process. |
|
inline |
Terminates the process.
|
inline |
Writes data to stdin.
| buf | Data to write. |
| size | Number of bytes to write. |
|
static |
Error exit code when a process exited non-gracefully, e.g. due to a segmentation fault.
|
static |
Error exit code when setting CPU affinity for the process.
|
static |
Error exit code due to not having sufficient permissions to execute the given command.
|
static |
Error exit code due to failing to find the given executable.
|
static |
Error exit code when setting environment variables.
|
static |
Error exit code when receiving a notification to start the process properly.
|
static |
Error exit code when opening or accessing the file for redirecting stderr.
|
static |
Error exit code when calling dup2() for redirecting stderr.
|
static |
Error exit code when calling dup2() for redirecting stdin.
|
static |
Error exit code when opening or accessing the file for redirecting stdout.
|
static |
Error exit code when calling dup2() for redirecting stdout.