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 299 of file XrdThrottleManager.hh.

Constructor & Destructor Documentation

◆ ~XrdThrottleTimer()

XrdThrottleTimer::~XrdThrottleTimer ( )
inline

Definition at line 306 of file XrdThrottleManager.hh.

307 {
308  if (m_manager) {
309  StopTimer();
310  }
311 }

◆ XrdThrottleTimer() [1/2]

XrdThrottleTimer::XrdThrottleTimer ( )
inlineprotected

Definition at line 315 of file XrdThrottleManager.hh.

315  :
316  m_start_time(std::chrono::steady_clock::time_point::min())
317 {}

◆ XrdThrottleTimer() [2/2]

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

Definition at line 319 of file XrdThrottleManager.hh.

319  :
320  m_owner(uid),
321  m_timer_list_entry(XrdThrottleManager::GetTimerListHash()),
322  m_manager(manager),
323  m_start_time(std::chrono::steady_clock::now())
324 {
325  if (!m_manager) {
326  return;
327  }
328  auto &timerList = m_manager->m_timer_list[m_timer_list_entry];
329  std::lock_guard<std::mutex> lock(timerList.m_mutex);
330  if (timerList.m_first == nullptr) {
331  timerList.m_first = this;
332  } else {
333  m_prev = timerList.m_last;
334  m_prev->m_next = this;
335  }
336  timerList.m_last = this;
337 }

Member Function Documentation

◆ Reset()

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

Definition at line 339 of file XrdThrottleManager.hh.

339  {
340  auto now = std::chrono::steady_clock::now();
341  auto last_start = m_start_time.exchange(now);
342  return now - last_start;
343 }
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 302 of file XrdThrottleManager.hh.


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