6a5e10492c
This decouples the build and packaging of guest-server, guest-agent from mtce, by splitting guest component into stx-nfv repo. This leaves existing C++ code, scripts, and resource files untouched, so there is no functional change. Code refactoring is beyond the scope of this update. Makefiles were modified to include devel headers directories /usr/include/mtce-common and /usr/include/mtce-daemon. This ensures there is no contamination with other system headers. The cgts-mtce-common package is renamed and split into: - repo stx-metal: mtce-common, mtce-common-dev - repo stx-metal: mtce - repo stx-nfv: mtce-guest - repo stx-ha: updates package dependencies to mtce-pmon for service-mgmt, sm, and sm-api mtce-common: - contains common and daemon shared source utility code mtce-common-dev: - based on mtce-common, contains devel package required to build mtce-guest and mtce - contains common library archives and headers mtce: - contains components: alarm, fsmon, fsync, heartbeat, hostw, hwmon, maintenance, mtclog, pmon, public, rmon mtce-guest: - contains guest component guest-server, guest-agent Story: 2002829 Task: 22748 Change-Id: I9c7a9b846fd69fd566b31aa3f12a043c08f19f1f Signed-off-by: Jim Gauld <james.gauld@windriver.com>
117 lines
3.3 KiB
C++
117 lines
3.3 KiB
C++
/*
|
|
* Copyright (c) 2015-2017 Wind River Systems, Inc.
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*
|
|
*/
|
|
|
|
/**
|
|
* @file
|
|
* Wind River Titanium Cloud Maintenance Time Utility Header
|
|
*/
|
|
|
|
#include "timeUtil.h"
|
|
|
|
typedef struct
|
|
{
|
|
bool init ;
|
|
|
|
time_debug_type last_time ;
|
|
time_debug_type this_time ;
|
|
time_delta_type diff_time ;
|
|
|
|
unsigned long under_50_msec ;
|
|
unsigned long under_500_msec;
|
|
unsigned long under_1_sec ;
|
|
unsigned long under_2_sec ;
|
|
unsigned long under_3_sec ;
|
|
unsigned long under_5_sec ;
|
|
unsigned long over_5_sec ;
|
|
|
|
unsigned long counter ;
|
|
} timeUtil_type ;
|
|
|
|
static timeUtil_type time_struct ;
|
|
|
|
void timeUtil_sched_init ( void )
|
|
{
|
|
gettime ( time_struct.last_time );
|
|
time_struct.under_50_msec = 0 ;
|
|
time_struct.under_500_msec = 0 ;
|
|
time_struct.under_1_sec = 0 ;
|
|
time_struct.under_2_sec = 0 ;
|
|
time_struct.under_3_sec = 0 ;
|
|
time_struct.under_5_sec = 0 ;
|
|
time_struct.over_5_sec = 0 ;
|
|
time_struct.counter = 0 ;
|
|
time_struct.init = true ;
|
|
}
|
|
|
|
void scheduling_histogram ( void )
|
|
{
|
|
ilog ("Under: 50ms: %ld - 500ms:%ld - 1s:%ld - 2s:%ld - 3s:%ld - 5s:%ld ---- over:%ld\n",
|
|
time_struct.under_50_msec,
|
|
time_struct.under_500_msec,
|
|
time_struct.under_1_sec,
|
|
time_struct.under_2_sec,
|
|
time_struct.under_3_sec,
|
|
time_struct.under_5_sec,
|
|
time_struct.over_5_sec);
|
|
}
|
|
|
|
void timeUtil_sched_sample ( void )
|
|
{
|
|
if ( time_struct.init == false )
|
|
{
|
|
elog ("Time struct not initialized\n");
|
|
return ;
|
|
}
|
|
gettime ( time_struct.this_time );
|
|
timedelta ( time_struct.last_time, time_struct.this_time, time_struct.diff_time );
|
|
|
|
if ( time_struct.diff_time.secs == 0 )
|
|
{
|
|
if ( time_struct.diff_time.msecs < 50000 ) time_struct.under_50_msec++ ;
|
|
else if ( time_struct.diff_time.msecs < 500000 ) time_struct.under_500_msec++ ;
|
|
else time_struct.under_1_sec++ ;
|
|
}
|
|
else
|
|
{
|
|
if ( time_struct.diff_time.secs < 2 )
|
|
{
|
|
time_struct.under_2_sec++ ;
|
|
}
|
|
else if ( time_struct.diff_time.secs < 3 )
|
|
{
|
|
wlog (">>> Minor Scheduling delay: %ld.%3ld secs\n",
|
|
time_struct.diff_time.secs,
|
|
time_struct.diff_time.msecs );
|
|
time_struct.under_3_sec++ ;
|
|
}
|
|
else if ( time_struct.diff_time.secs < 5 )
|
|
{
|
|
wlog (">>> Major Scheduling delay: %ld.%3ld secs\n",
|
|
time_struct.diff_time.secs,
|
|
time_struct.diff_time.msecs );
|
|
time_struct.under_5_sec++ ;
|
|
scheduling_histogram ( );
|
|
}
|
|
else
|
|
{
|
|
wlog (">>> Critical Scheduling delay: %ld.%3ld secs\n",
|
|
time_struct.diff_time.secs,
|
|
time_struct.diff_time.msecs );
|
|
time_struct.over_5_sec++ ;
|
|
scheduling_histogram ( );
|
|
}
|
|
}
|
|
time_struct.last_time.ts.tv_sec = time_struct.this_time.ts.tv_sec ;
|
|
time_struct.last_time.ts.tv_nsec = time_struct.this_time.ts.tv_nsec ;
|
|
|
|
if ( ++time_struct.counter >= 1000 )
|
|
{
|
|
scheduling_histogram ( );
|
|
time_struct.counter = 0 ;
|
|
}
|
|
}
|