= {
"5s",
"1min",
"5min",
"1h",
"1d",
"1w",
"1mon",
"3mon",
"1y",
"life"};
48= {0, 12, 5, 12, 24, 7, 31, 3, 4, 0};
70 #define USE_DETAILED_SLOT_STAT 1 71 #if USE_DETAILED_SLOT_STAT 86gmtime_r(&adj_secs, &
t);
105gmtime_r(&cur_secs, &
t);
116gmtime_r(&cur_secs, &
t);
117 if(
t.tm_mon == 1) {
119 t.tm_hour =
t.tm_min =
t.tm_sec = 0;
121time_t next_loc_time = mktime(&
t);
123localtime_r(&next_loc_time, &
t);
127 switch(
t.tm_mon) {
258 for(
int i= 0;
i< 40; ++
i) {
407dst_stat->
m_SrvStat->CollectThreads(need_clear);
427stat->m_StatName = stat_type;
434stat_copy->m_StatName = stat_type;
435stat_copy->x_CopyStartState(stat);
436stat_copy->AddAllStats(stat);
460 return Uint4(cnt_cmds);
561 #if USE_DETAILED_SLOT_STAT 629stat_5s->m_SrvStat->SaveEndStateStat();
636proxy <<
"Commands by status and type:"<< endl;
638proxy << it_st->first <<
":"<< endl;
642proxy << it_cmd->first <<
" - " 651proxy <<
"Client writes by size:"<< endl;
654; ++
i, prev_size =
size+ 1,
size<<= 1)
668proxy <<
"Client reads by size:"<< endl;
671; ++
i, prev_size =
size+ 1,
size<<= 1)
685proxy <<
"Disk writes by size:"<< endl;
688; ++
i, prev_size =
size+ 1,
size<<= 1)
707 ctx->SetRequestID();
833 stringis(
"\": "), iss(
"\": \""), eol(
",\n\""),
str(
"_str");
878proxy <<
", start "<<
buf;
880proxy <<
", end "<<
buf<<endl;
884proxy <<
"Draining started, estimated end: "<<
buf<< endl;
898proxy <<
"Sync servers: "<<
NStr::Join(
t,
",") << endl;
902proxy <<
"Initial Sync succeeded - "<<
908proxy <<
"Initial Sync failed - "<<
912 #if USE_DETAILED_SLOT_STAT 915 if(!peer_name.empty()) {
922proxy <<
"Periodic Sync succeeded - "<<
923peer_name <<
" slot "<<
i->first <<
" "<<
924agoSec <<
"."<< agoUsec <<
"s ago"<< endl;
931 if(!peer_name.empty()) {
935proxy <<
"Periodic Sync succeeded - "<<
936peer_name <<
" at "<<
buf<<
", "<<
937agoSec <<
"."<< agoUsec <<
"s ago"<< endl;
950proxy <<
"DB start - " 958proxy <<
", dead: "<<
buf;
969proxy <<
", dead: "<<
buf;
980proxy <<
"Start cache - " 983proxy <<
"End cache - " 986proxy <<
"Avg cache - " 989proxy <<
"Max cache - " 992proxy <<
"WB start - " 1000proxy <<
"WB avg - " 1004proxy <<
"WB max - " 1008proxy <<
"Blob storage start - " 1010<<
"blob update delay: " 1016proxy <<
"Blob storage end - " 1018<<
"blob update delay: " 1024proxy <<
"Start mirror connections - " 1027proxy <<
"End mirror connections - " 1030proxy <<
"Avg mirror connections - " 1033proxy <<
"Max mirror connections - " 1036proxy <<
"Start queues - " 1039proxy <<
"End queues - " 1042proxy <<
"Avg queues - " 1045proxy <<
"Max queues - " 1048proxy <<
"Cmds progress - " 1051proxy <<
"Cmds stat - " 1056proxy <<
"Client writes - " 1061proxy <<
"Client unfinished - " 1064proxy <<
"Client reads - " 1069proxy <<
"Peer writes - " 1072proxy <<
"Peer reads - " 1075proxy <<
"Peer syncs - " 1081proxy <<
"Disk writes - " 1086proxy <<
"Disk reads - " 1089proxy <<
"Shrink check - " 1094proxy <<
"Shrink moves - " 1172 #if __NC_TASKS_MONITOR 1173m_TaskName =
"CStatRotator";
1183 #ifdef NCBI_OS_LINUX 1186gmtime_r(&cur_secs, &
t);
1199 for(
int i= 0;
i< cnt_iter; ++
i) {
Mutex created to have minimum possible size (its size is 4 bytes) and to sleep using kernel capabilit...
void Unlock(void)
Unlock the mutex.
void Lock(void)
Lock the mutex.
static int GetLatestBlobExpire(void)
static bool IsDraining(void)
static string GetPeerNameOrEmpty(Uint8 srv_id)
static string GetPeerName(Uint8 srv_id)
static void ReadCurState(SNCStateStat &state)
Class collecting statistics about NetCache server.
static bool AddUnknownServer(Uint8 srv_id)
void x_CopyStartState(CNCStat *src_stat)
static void AddSyncServer(Uint8 srv_id)
static Uint4 GetCntRunningCmds(void)
static void CmdFinished(const char *cmd, Uint8 len_usec, int status)
vector< TSrvTimeTerm > m_ClRdLenBySize
TCmdCountsMap m_CmdsByName
static CSrvRef< CNCStat > GetStat(const string &stat_type, bool is_prev)
static void ConnClosing(Uint8 cnt_cmds)
void x_CopyEndState(CNCStat *src_stat)
CSrvStatTerm< Uint8 > m_CntKeys
CSrvStatTerm< Uint4 > m_CntFiles
void AddAllStats(CNCStat *src_stat)
static void DiskDataWrite(size_t data_size)
static void SaveCurStateStat(const SNCStateStat &state)
static void PeerSyncFinished(Uint8 srv_id, Uint2 slot, Uint8 cnt_ops, bool success)
CSrvStatTerm< Uint8 > m_MirrorQSize
CSrvStatTerm< size_t > m_WBReleasing
void PrintToLogs(CTempString stat_name)
CSrvStatTerm< Uint4 > m_CheckedRecs
vector< Uint8 > m_DiskWrBySize
void InitStartState(void)
CSrvStatTerm< int > m_MirrorActiveConns
CSrvStatTerm< size_t > m_WBReleasable
CSrvStatTerm< Uint4 > m_MovedSize
SNCStateStat m_StartState
static void DiskBlobWrite(Uint8 blob_size)
static void ClientDataRead(size_t data_size)
static void PeerDataWrite(size_t data_size)
static void CmdStarted(const char *cmd)
static void ClientBlobRollback(Uint8 written_size)
CSrvStatTerm< Uint8 > m_ConnCmds
void PrintState(CSrvSocketTask &sock)
void TransferEndState(CNCStat *src_stat)
static void InitialSyncDone(Uint8 srv_id, bool succeeded)
CSrvStatTerm< int > m_MirrorBGConns
static void DumpAllStats(void)
static void ClientBlobWrite(Uint8 blob_size, Uint8 len_usec)
void x_AddStats(CNCStat *src_stat)
CSrvStatTerm< Uint8 > m_SyncLogSize
void x_SaveEndState(void)
static void DBFileCleaned(bool success, Uint4 seen_recs, Uint4 moved_recs, Uint4 moved_size)
void PrintToSocket(CSrvSocketTask *sock)
void x_PrintUnstructured(CSrvPrintProxy &proxy)
static void PeerDataRead(size_t data_size)
CSrvStatTerm< Uint8 > m_CntBlobs
static void CollectThreads(CNCStat *dst_stat, bool need_clear)
vector< TSrvTimeTerm > m_ClWrLenBySize
static void ClientBlobRead(Uint8 blob_size, Uint8 len_usec)
unique_ptr< CSrvStat > m_SrvStat
static void ClientDataWrite(size_t data_size)
CSrvStatTerm< Uint4 > m_MovedRecs
CSrvStatTerm< size_t > m_WBMemSize
static void Initialize(void)
static void DiskDataRead(size_t data_size)
CSrvStatTerm< Uint8 > m_GarbageSize
CSrvStatTerm< Uint8 > m_DBSize
TStatusCmdLens m_LensByStatus
Class used in all diagnostic logging.
CSrvDiagMsg & StartRequest(void)
Starts "request-start" message.
CSrvDiagMsg & PrintParam(CTempString name, CTempString value)
Adds parameter to "request-start" or "extra" message.
void StopRequest(void)
Prints "request-stop" message.
void Flush(void)
Finishes current message and prepare to start new one.
Stream-like class to help unify printing some text messages to diagnostics and to any socket.
Special variant of CRef that doesn't check for NULL when dereferencing.
Task controlling a socket.
CSrvSocketTask & WriteText(CTempString message)
Write text into socket.
CSrvSocketTask & WriteNumber(NumType num)
Write number into socket as string, i.e.
T GetAverage(void) const
Get average of all values in the set.
Uint8 GetCount(void) const
Get number of values in the set.
void Initialize(void)
Initialize all data members.
Uint8 GetSum(void) const
Get sum of all values in the set.
void AddValue(T value)
Add next value into the set.
void AddValues(const CSrvStatTerm< T > &other)
Add all values from another set.
T GetMaximum(void) const
Get maximum value in the set.
void RunAfter(Uint4 delay_sec)
This call is basically equivalent to SetRunnable() but with guarantee that task will be scheduled for...
Class incorporating convenient methods to work with struct timespec.
static int CurSecs(void)
Current time in seconds since epoch (time_t).
static int TZAdjustment(void)
Timezone adjustment (in seconds) for times stored in CSrvTime.
static CSrvTime Current(void)
Exact current time with precision up to nanoseconds.
Uint8 AsUSec(void) const
Converts object's value to microseconds since epoch.
Uint1 Print(char *buf, EFormatType fmt) const
Formats time value in the object and writes it in buf.
@ eFmtHumanUSecs
Format that can be readable by humans with precision up to microseconds.
@ eFmtHumanSeconds
Format that can be readable by humans with precision up to seconds.
@ eFmtLogging
Format used in logs which is YYYY-MM-DDThh:mm:ss.ssssss.
virtual ~CStatRotator(void)
virtual void ExecuteSlice(TSrvThreadNum thr_num)
This is the main method to do all work this task should do.
static TSrvThreadNum GetMaxRunningThreads(void)
Returns maximum number of worker threads allowed ([task_server]/max_threads parameter in ini-file).
static TSrvThreadNum GetCurThreadNum(void)
Returns number of current worker thread. Number is 0-based.
static bool IsInShutdown(void)
Checks if TaskServer received request to shutdown.
CTempString implements a light-weight string on top of a storage buffer whose lifetime management is ...
container_type::const_iterator const_iterator
const_iterator begin() const
const_iterator end() const
static const char * str(char *buf, int n)
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
void AddReference(void) const
Add reference to object.
void RemoveReference(void) const
Remove reference to object.
uint8_t Uint1
1-byte (8-bit) unsigned integer
uint32_t Uint4
4-byte (32-bit) unsigned integer
uint16_t Uint2
2-byte (16-bit) unsigned integer
uint64_t Uint8
8-byte (64-bit) unsigned integer
static TPid GetPid(void)
Get process identifier (pid) for the current process.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static int strcmp(const char *s1, const char *s2)
String compare.
static string Join(const TContainer &arr, const CTempString &delim)
Join strings using the specified delimiter.
static string UInt8ToString_DataSize(Uint8 value, TNumToStringFlags flags=0, unsigned int max_digits=3)
Convert UInt8 to string using "software" qualifiers.
string GetSoftFatalAction(void)
string GetLogVisibility(void)
const struct ncbi::grid::netcache::search::fields::SIZE size
static CNCStat ** s_CurPeriodStat
static TSyncTimes s_SyncFailed
static const char *const kStatPeriodName[kCntStatPeriods]
static const Uint1 kMinStatPeriod
map< Uint8, map< Uint2, CSrvTime > > TDetailedSyncTimes
static CNCStat * s_ThreadStat
static CNCStat * s_Stat(void)
static const Uint1 kLifePeriodIdx
static void s_SetCurMonthSize(void)
static Uint1 kCollectPeriodsCnt[kCntStatPeriods]
static int s_LastRotateSecs
map< Uint8, CSrvTime > TSyncTimes
static void s_CheckTZChange(void)
static CMiniMutex s_RotateLock
static void s_CollectCurStats(void)
static void s_InitPeriodsCollected(void)
static CStatRotator * s_Rotator
static Uint1 s_PeriodsCollected[kCntStatPeriods]
static const Uint1 kMonthPeriodIdx
static unsigned int s_SizeIndex(Uint8 size)
static void s_ShiftStats(Uint1 idx)
static const Uint1 kCntStatPeriods
static TDetailedSyncTimes s_SyncPeriodic
static TSyncTimes s_SyncSucceeded
static CNCStat ** s_PrevPeriodStat
static const Uint1 kDayPeriodIdx
static set< Uint8 > s_SyncSrv
static CMiniMutex s_CommonStatLock
static set< Uint8 > s_UnknownSrv
Defines CRequestContext class for NCBI C++ diagnostic API.
Uint8 g_CalcStatPct(Uint8 val, Uint8 total)
std::enable_if< std::is_unsigned< T >::value, string >::type g_ToSizeStr(T size)
string g_ToSmartStr(T num)
double g_AsMSecStat(Uint8 time_usec)
unsigned int g_GetLogBase2(Uint8 value)
Get integer part of the logarithm with base 2.
TSrvTimeTerm & g_SrvTimeTerm(Map &map, Key key)
T AtomicAdd(T volatile &var, T add_value)
constexpr Uint8 kMSecsPerSecond
constexpr Uint8 kUSecsPerSecond
constexpr Uint8 kUSecsPerMSec
bool operator()(const char *left, const char *right) const
Uint8 cnt_another_server_main
Uint8 avg_tdiff_blobnotify
Uint8 max_tdiff_blobnotify
Uint2 TSrvThreadNum
Type for thread number in TaskServer.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4