ROOT
6.12/07
Reference Guide
proof
proofd
inc
XrdProofdPriorityMgr.h
Go to the documentation of this file.
1
// @(#)root/proofd:$Id$
2
// Author: G. Ganis Feb 2008
3
4
/*************************************************************************
5
* Copyright (C) 1995-2005, Rene Brun and Fons Rademakers. *
6
* All rights reserved. *
7
* *
8
* For the licensing terms see $ROOTSYS/LICENSE. *
9
* For the list of contributors see $ROOTSYS/README/CREDITS. *
10
*************************************************************************/
11
12
#ifndef ROOT_XrdProofdPriorityMgr
13
#define ROOT_XrdProofdPriorityMgr
14
15
//////////////////////////////////////////////////////////////////////////
16
// //
17
// XrdProofdPriorityMgr //
18
// //
19
// Author: G. Ganis, CERN, 2007 //
20
// //
21
// Class managing session priorities. //
22
// //
23
//////////////////////////////////////////////////////////////////////////
24
#include <list>
25
26
#include "
XpdSysPthread.h
"
27
28
#include "XrdOuc/XrdOucHash.hh"
29
#include "XrdOuc/XrdOucString.hh"
30
31
#include "
XrdProofdConfig.h
"
32
33
class
XrdProofdDirective
;
34
class
XrdProofdManager
;
35
36
//
37
// Small class to describe an active session
38
//
39
#define XPPM_NOPRIORITY 999999
40
class
XrdProofdSessionEntry
{
41
public
:
42
XrdOucString
fUser
;
43
XrdOucString
fGroup
;
44
int
fPid
;
45
int
fDefaultPriority
;
46
int
fPriority
;
47
float
fFracEff
;
// Resource fraction in % (effective)
48
49
XrdProofdSessionEntry
(
const
char
*u,
const
char
*
g
,
int
pid);
50
virtual
~XrdProofdSessionEntry
();
51
52
int
SetPriority
(
int
priority =
XPPM_NOPRIORITY
);
53
};
54
55
class
XrdProofdPriorityMgr
:
public
XrdProofdConfig
{
56
57
XrdSysRecMutex
fMutex
;
// Atomize this instance
58
59
XrdProofdManager
*
fMgr
;
60
XrdOucHash<XrdProofdSessionEntry>
fSessions
;
// list of active sessions (keyed by "pid")
61
XrdOucHash<XrdProofdPriority>
fPriorities
;
// list of {users, priority change}
62
63
XrdProofdPipe
fPipe
;
64
65
int
fSchedOpt
;
// Worker sched option
66
int
fPriorityMax
;
// Max session priority [1,40], [20]
67
int
fPriorityMin
;
// Min session priority [1,40], [1]
68
69
void
RegisterDirectives();
70
int
DoDirectivePriority(
char
*, XrdOucStream *,
bool
);
71
int
DoDirectiveSchedOpt(
char
*, XrdOucStream *,
bool
);
72
73
public
:
74
XrdProofdPriorityMgr
(
XrdProofdManager
*mgr, XrdProtocol_Config *
pi
,
XrdSysError
*
e
);
75
virtual
~XrdProofdPriorityMgr
() { }
76
77
enum
PMProtocol
{ kChangeStatus = 0, kSetGroupPriority = 1 };
78
79
int
Config(
bool
rcf = 0);
80
int
DoDirective(
XrdProofdDirective
*d,
81
char
*val, XrdOucStream *cfg,
bool
rcf);
82
83
inline
XrdProofdPipe
*
Pipe
() {
return
&fPipe; }
84
85
int
AddSession(
const
char
*u,
const
char
*
g
,
int
pid);
86
int
RemoveSession(
int
pid);
87
void
SetGroupPriority(
const
char
*grp,
int
priority);
88
89
// Scheduling
90
bool
IsSchedOn
() {
return
((fSchedOpt !=
kXPD_sched_off
) ? 1 : 0); }
91
int
SetNiceValues(
int
opt = 0);
92
void
SetSchedOpt
(
int
opt) {
XrdSysMutexHelper
mhp(&fMutex);
93
fSchedOpt = opt; }
94
int
SetProcessPriority(
int
pid,
const
char
*usr,
int
&dp);
95
};
96
97
#endif
XrdProofdDirective
Definition:
XrdProofdAux.h:108
TGeoUnit::pi
static constexpr double pi
Definition:
TGeoSystemOfUnits.h:67
XrdProofdPriorityMgr
Definition:
XrdProofdPriorityMgr.h:55
XrdProofdPriorityMgr::SetSchedOpt
void SetSchedOpt(int opt)
Definition:
XrdProofdPriorityMgr.h:92
XpdSysPthread.h
XrdProofdConfig.h
XrdProofdPriorityMgr::fPriorityMin
int fPriorityMin
Definition:
XrdProofdPriorityMgr.h:67
XrdProofdPriorityMgr::fPriorityMax
int fPriorityMax
Definition:
XrdProofdPriorityMgr.h:66
XrdSysRecMutex
#define XrdSysRecMutex
Definition:
XrdSysToOuc.h:18
XrdProofdSessionEntry::fGroup
XrdOucString fGroup
Definition:
XrdProofdPriorityMgr.h:43
XrdProofdPriorityMgr::PMProtocol
PMProtocol
Definition:
XrdProofdPriorityMgr.h:77
XrdProofdPriorityMgr::fPriorities
XrdOucHash< XrdProofdPriority > fPriorities
Definition:
XrdProofdPriorityMgr.h:61
XrdProofdPipe
Definition:
XrdProofdAux.h:200
XPPM_NOPRIORITY
#define XPPM_NOPRIORITY
Definition:
XrdProofdPriorityMgr.h:39
XrdProofdSessionEntry::fPid
int fPid
Definition:
XrdProofdPriorityMgr.h:44
XrdProofdSessionEntry::fFracEff
float fFracEff
Definition:
XrdProofdPriorityMgr.h:47
XrdProofdPriorityMgr::fMgr
XrdProofdManager * fMgr
Definition:
XrdProofdPriorityMgr.h:59
XrdProofdPriorityMgr::IsSchedOn
bool IsSchedOn()
Definition:
XrdProofdPriorityMgr.h:90
XrdProofdPriorityMgr::fSchedOpt
int fSchedOpt
Definition:
XrdProofdPriorityMgr.h:65
XrdProofdPriorityMgr::fPipe
XrdProofdPipe fPipe
Definition:
XrdProofdPriorityMgr.h:63
XrdProofdSessionEntry
Definition:
XrdProofdPriorityMgr.h:40
XrdProofdConfig
Definition:
XrdProofdConfig.h:31
XrdProofdPriorityMgr::Pipe
XrdProofdPipe * Pipe()
Definition:
XrdProofdPriorityMgr.h:83
XrdProofdPriorityMgr::fMutex
XrdSysRecMutex fMutex
Definition:
XrdProofdPriorityMgr.h:57
XrdSysMutexHelper
#define XrdSysMutexHelper
Definition:
XrdSysToOuc.h:17
XrdSysError
#define XrdSysError
Definition:
XpdSysError.h:8
XrdProofdPriorityMgr::~XrdProofdPriorityMgr
virtual ~XrdProofdPriorityMgr()
Definition:
XrdProofdPriorityMgr.h:75
XrdProofdSessionEntry::fDefaultPriority
int fDefaultPriority
Definition:
XrdProofdPriorityMgr.h:45
kXPD_sched_off
Definition:
XProofProtocol.h:126
XrdProofdSessionEntry::XrdProofdSessionEntry
XrdProofdSessionEntry(const char *u, const char *g, int pid)
Constructor.
Definition:
XrdProofdPriorityMgr.cxx:582
XrdProofdSessionEntry::SetPriority
int SetPriority(int priority=XPPM_NOPRIORITY)
Change process priority.
Definition:
XrdProofdPriorityMgr.cxx:609
e
you should not use this method at all Int_t Int_t Double_t Double_t Double_t e
Definition:
TRolke.cxx:630
XrdProofdSessionEntry::fPriority
int fPriority
Definition:
XrdProofdPriorityMgr.h:46
XrdProofdPriorityMgr::fSessions
XrdOucHash< XrdProofdSessionEntry > fSessions
Definition:
XrdProofdPriorityMgr.h:60
XrdProofdSessionEntry::~XrdProofdSessionEntry
virtual ~XrdProofdSessionEntry()
Destructor.
Definition:
XrdProofdPriorityMgr.cxx:601
XrdProofdManager
Definition:
XrdProofdManager.h:56
XrdProofdSessionEntry::fUser
XrdOucString fUser
Definition:
XrdProofdPriorityMgr.h:42
TGeoUnit::g
static constexpr double g
Definition:
TGeoSystemOfUnits.h:203