[Lldb-commits] [lldb] [lldb] Adds additional fields to ProcessInfo (PR #91544)
Greg Clayton via lldb-commits
lldb-commits at lists.llvm.org
Mon May 20 16:18:04 PDT 2024
================
@@ -195,48 +195,66 @@ class ProcessInstanceInfo : public ProcessInfo {
return m_process_session_id != LLDB_INVALID_PROCESS_ID;
}
- struct timespec GetUserTime() const { return m_user_time; }
+ struct timespec GetUserTime() const { return m_user_time.value(); }
void SetUserTime(struct timespec utime) { m_user_time = utime; }
bool UserTimeIsValid() const {
- return m_user_time.tv_sec > 0 || m_user_time.tv_usec > 0;
+ return m_user_time.has_value() &&
+ (m_user_time->tv_sec > 0 || m_user_time->tv_usec > 0);
}
- struct timespec GetSystemTime() const { return m_system_time; }
+ struct timespec GetSystemTime() const { return m_system_time.value(); }
void SetSystemTime(struct timespec stime) { m_system_time = stime; }
bool SystemTimeIsValid() const {
- return m_system_time.tv_sec > 0 || m_system_time.tv_usec > 0;
+ return m_system_time.has_value() &&
+ (m_system_time->tv_sec > 0 || m_system_time->tv_usec > 0);
}
struct timespec GetCumulativeUserTime() const {
- return m_cumulative_user_time;
+ return m_cumulative_user_time.value();
}
void SetCumulativeUserTime(struct timespec cutime) {
m_cumulative_user_time = cutime;
}
bool CumulativeUserTimeIsValid() const {
- return m_cumulative_user_time.tv_sec > 0 ||
- m_cumulative_user_time.tv_usec > 0;
+ return m_cumulative_user_time.has_value() &&
+ (m_cumulative_user_time->tv_sec > 0 ||
+ m_cumulative_user_time->tv_usec > 0);
}
struct timespec GetCumulativeSystemTime() const {
- return m_cumulative_system_time;
+ return m_cumulative_system_time.value();
}
void SetCumulativeSystemTime(struct timespec cstime) {
m_cumulative_system_time = cstime;
}
bool CumulativeSystemTimeIsValid() const {
- return m_cumulative_system_time.tv_sec > 0 ||
- m_cumulative_system_time.tv_usec > 0;
+ return m_cumulative_system_time.has_value() &&
+ (m_cumulative_system_time->tv_sec > 0 ||
+ m_cumulative_system_time->tv_usec > 0);
}
+ int8_t GetPriorityValue() const { return m_priority_value.value(); }
+
+ void SetPriorityValue(int8_t priority_value) {
+ m_priority_value = priority_value;
+ }
+
+ bool PriorityValueIsValid() const;
----------------
clayborg wrote:
This should be removed as this is the point of using std::optionals.
https://github.com/llvm/llvm-project/pull/91544
More information about the lldb-commits
mailing list