XRootD
XrdThrottleTimer Class Reference

#include <XrdThrottleManager.hh>

+ Collaboration diagram for XrdThrottleTimer:

Public Member Functions

 ~XrdThrottleTimer ()
 

Protected Member Functions

 XrdThrottleTimer ()
 
 XrdThrottleTimer (XrdThrottleManager *manager, int uid)
 
std::chrono::steady_clock::duration Reset ()
 

Friends

class XrdThrottleManager
 

Detailed Description

Definition at line 278 of file XrdThrottleManager.hh.

Constructor & Destructor Documentation

◆ ~XrdThrottleTimer()

XrdThrottleTimer::~XrdThrottleTimer ( )
inline

Definition at line 285 of file XrdThrottleManager.hh.

286 {
287  if (m_manager) {
288  StopTimer();
289  }
290 }

◆ XrdThrottleTimer() [1/2]

XrdThrottleTimer::XrdThrottleTimer ( )
inlineprotected

Definition at line 294 of file XrdThrottleManager.hh.

294  :
295  m_start_time(std::chrono::steady_clock::time_point::min())
296 {}

◆ XrdThrottleTimer() [2/2]

XrdThrottleTimer::XrdThrottleTimer ( XrdThrottleManager manager,
int  uid 
)
inlineprotected

Definition at line 298 of file XrdThrottleManager.hh.

298  :
299  m_owner(uid),
300  m_timer_list_entry(XrdThrottleManager::GetTimerListHash()),
301  m_manager(manager),
302  m_start_time(std::chrono::steady_clock::now())
303 {
304  if (!m_manager) {
305  return;
306  }
307  auto &timerList = m_manager->m_timer_list[m_timer_list_entry];
308  std::lock_guard<std::mutex> lock(timerList.m_mutex);
309  if (timerList.m_first == nullptr) {
310  timerList.m_first = this;
311  } else {
312  m_prev = timerList.m_last;
313  m_prev->m_next = this;
314  }
315  timerList.m_last = this;
316 }

Member Function Documentation

◆ Reset()

std::chrono::steady_clock::duration XrdThrottleTimer::Reset ( )
inlineprotected

Definition at line 318 of file XrdThrottleManager.hh.

318  {
319  auto now = std::chrono::steady_clock::now();
320  auto last_start = m_start_time.exchange(now);
321  return now - last_start;
322 }
T exchange(T v, std::memory_order mo=std::memory_order_relaxed) noexcept

References XrdSys::RAtomic< T >::exchange().

+ Here is the call graph for this function:

Friends And Related Function Documentation

◆ XrdThrottleManager

friend class XrdThrottleManager
friend

Definition at line 281 of file XrdThrottleManager.hh.


The documentation for this class was generated from the following file: