-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide access to resource usage for processes and nodes #335
Open
rhc54
wants to merge
1
commit into
pmix:v4
Choose a base branch
from
rhc54:rfc4.1/pstat
base: v4
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1167,3 +1167,281 @@ \subsection{Log attributes} | |
} | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\section{Resource Usage} | ||
\label{api:resusage} | ||
|
||
Applications and tools often want to obtain a snapshot of the resources utilized by individual | ||
processes and/or nodes in their job. \ac{PMIx} provides attributes for querying such information | ||
and accompanying structures for the results. | ||
|
||
\subsection{Process statistics} | ||
\label{api:pstats:struct} | ||
|
||
The process statistics structure contains information available from many \acp{OS}. The field | ||
corresponding to any information that is not available will be set to zero. | ||
|
||
\declarestruct{pmix_proc_stats_t} | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
typedef struct pmix_proc_stats \{ | ||
/* process ident info */ | ||
char *node; | ||
pmix_proc_t proc; | ||
pid_t pid; | ||
char *cmd; | ||
/* process stats */ | ||
char state[2]; | ||
struct timeval time; | ||
float percent_cpu; | ||
int32_t priority; | ||
uint16_t num_threads; | ||
float pss; /* in MBytes */ | ||
float vsize; /* in MBytes */ | ||
float rss; /* in MBytes */ | ||
float peak_vsize; /* in MBytes */ | ||
uint16_t processor; | ||
/* time at which sample was taken */ | ||
struct timeval sample_time; | ||
\} pmix_proc_stats_t; | ||
\end{codepar} | ||
\cspecificend | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\subsubsection{Process statistics support macros} | ||
The following macros are provided to support the \refstruct{pmix_proc_stats_t} structure. | ||
|
||
\littleheader{Initialize the proc stats structure} | ||
\declaremacro{PMIX_PROC_STATS_CONSTRUCT} | ||
|
||
Initialize the \refstruct{pmix_proc_stats_t} fields. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_PROC_STATS_CONSTRUCT(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the structure to be initialized (pointer to \refstruct{pmix_proc_stats_t})} | ||
\end{arglist} | ||
|
||
\littleheader{Destruct the proc stats structure} | ||
\declaremacro{PMIX_PROC_STATS_DESTRUCT} | ||
|
||
Destruct the \refstruct{pmix_proc_stats_t} fields. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_PROC_STATS_DESTRUCT(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the structure to be destructed (pointer to \refstruct{pmix_proc_stats_t})} | ||
\end{arglist} | ||
|
||
\littleheader{Create a proc stats array} | ||
\declaremacro{PMIX_PROC_STATS_CREATE} | ||
|
||
Allocate and initialize an array of \refstruct{pmix_proc_stats_t} structures. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_PROC_STATS_CREATE(m, n) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\arginout{m}{Address where the pointer to the array of \refstruct{pmix_proc_stats_t} structures shall be stored (handle)} | ||
\argin{n}{Number of structures to be allocated (\code{size_t})} | ||
\end{arglist} | ||
|
||
|
||
\littleheader{Free a proc stats structure} | ||
\declaremacro{PMIX_PROC_STATS_RELEASE} | ||
|
||
Release a \refstruct{pmix_proc_stats_t} structure. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_PROC_STATS_RELEASE(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to a \refstruct{pmix_proc_stats_t} structure (handle)} | ||
\end{arglist} | ||
|
||
\littleheader{Free a proc stats array} | ||
\declaremacro{PMIX_PROC_STATS_FREE} | ||
|
||
Release an array of \refstruct{pmix_proc_stats_t} structures. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_PROC_STATS_FREE(m, n) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the array of \refstruct{pmix_proc_stats_t} structures (handle)} | ||
\argin{n}{Number of structures in the array (\code{size_t})} | ||
\end{arglist} | ||
|
||
\subsection{Process statistics attributes} | ||
\label{api:pstats:attrs} | ||
|
||
The following attributes can be used to query for process statistics: | ||
|
||
\declareAttributeNEW{PMIX_PROC_RESOURCE_USAGE}{"pmix.pstats"}{pmix_proc_t}{ | ||
Return the resource usage statistics for the specified process in a \refstruct{pmix_proc_stats_t} structure. | ||
If a namespace is combined with | ||
\refconst{PMIX_RANK_WILDCARD}, then results for all processes in the given job | ||
will be returned in a \refstruct{pmix_data_array_t} of \refstruct{pmix_proc_stats_t} structures. | ||
This attribute can be used with | ||
qualifiers such as \refattr{PMIX_SESSION_ID} to identify the session of the namespace whose | ||
statistics are being requested. | ||
} | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\subsection{Node statistics} | ||
\label{api:ndstats:struct} | ||
|
||
The node statistics structure contains information available from many \acp{OS}. The field | ||
corresponding to any information that is not available will be set to zero. Note that the | ||
resource usage reported in the node statistics is an aggregate of all activity on the node | ||
and not just activity associated with the caller's job. | ||
|
||
\declarestruct{pmix_node_stats_t} | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
typedef struct pmix_node_stats \{ | ||
char *node; | ||
/* node-level load averages */ | ||
float la; | ||
float la5; | ||
float la15; | ||
/* memory usage */ | ||
float total_mem; /* in MBytes */ | ||
float free_mem; /* in MBytes */ | ||
float buffers; /* in MBytes */ | ||
float cached; /* in MBytes */ | ||
float swap_cached; /* in MBytes */ | ||
float swap_total; /* in MBytes */ | ||
float swap_free; /* in MBytes */ | ||
float mapped; /* in MBytes */ | ||
/* time at which sample was taken */ | ||
struct timeval sample_time; | ||
\} pmix_node_stats_t; | ||
\end{codepar} | ||
\cspecificend | ||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% | ||
\subsubsection{Node statistics support macros} | ||
The following macros are provided to support the \refstruct{pmix_node_stats_t} structure. | ||
|
||
\littleheader{Initialize the node stats structure} | ||
\declaremacro{PMIX_NODE_STATS_CONSTRUCT} | ||
|
||
Initialize the \refstruct{pmix_node_stats_t} fields. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_NODE_STATS_CONSTRUCT(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the structure to be initialized (pointer to \refstruct{pmix_node_stats_t})} | ||
\end{arglist} | ||
|
||
\littleheader{Destruct the node stats structure} | ||
\declaremacro{PMIX_NODE_STATS_DESTRUCT} | ||
|
||
Destruct the \refstruct{pmix_node_stats_t} fields. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_NODE_STATS_DESTRUCT(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the structure to be destructed (pointer to \refstruct{pmix_node_stats_t})} | ||
\end{arglist} | ||
|
||
\littleheader{Create a node stats array} | ||
\declaremacro{PMIX_NODE_STATS_CREATE} | ||
|
||
Allocate and initialize an array of \refstruct{pmix_node_stats_t} structures. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_NODE_STATS_CREATE(m, n) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\arginout{m}{Address where the pointer to the array of \refstruct{pmix_node_stats_t} structures shall be stored (handle)} | ||
\argin{n}{Number of structures to be allocated (\code{size_t})} | ||
\end{arglist} | ||
|
||
|
||
\littleheader{Free a node stats structure} | ||
\declaremacro{PMIX_NODE_STATS_RELEASE} | ||
|
||
Release a \refstruct{pmix_node_stats_t} structure. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_NODE_STATS_RELEASE(m) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to a \refstruct{pmix_node_stats_t} structure (handle)} | ||
\end{arglist} | ||
|
||
\littleheader{Free a node stats array} | ||
\declaremacro{PMIX_NODE_STATS_FREE} | ||
|
||
Release an array of \refstruct{pmix_node_stats_t} structures. | ||
|
||
\versionMarker{4.1} | ||
\cspecificstart | ||
\begin{codepar} | ||
PMIX_NODE_STATS_FREE(m, n) | ||
\end{codepar} | ||
\cspecificend | ||
|
||
\begin{arglist} | ||
\argin{m}{Pointer to the array of \refstruct{pmix_node_stats_t} structures (handle)} | ||
\argin{n}{Number of structures in the array (\code{size_t})} | ||
\end{arglist} | ||
|
||
\subsection{Node statistics attributes} | ||
\label{api:ndstats:attrs} | ||
|
||
The following attributes can be used to query for node statistics: | ||
|
||
\declareAttributeNEW{PMIX_NODE_RESOURCE_USAGE}{"pmix.ndstats"}{char*}{ | ||
Return the resource usage statistics for the specified node in a \refstruct{pmix_node_stats_t} structure. | ||
If no node is specified, then | ||
results for all nodes hosting processes within the job of the requestor | ||
will be returned in a \refstruct{pmix_data_array_t} of \refstruct{pmix_node_stats_t} structures. | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the
|
||
|
||
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have a link to more descriptions on each of these stats? We take them from Linux so a pointer to a good manpage description would be helpful to someone new to these fields.