* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @oneof Set to UEOF_CONT if an unexpected end of file should not make
* sadf stop. Default behavior is to stop on unexpected EOF.
*
* If current record was a special one (RESTART or COMMENT) and
* noted to be ignored, then the timestamp is saved only if
* explicitly told to do so with the SET_TIMESTAMPS action flag.
- * @loctime Structure where timestamp (expressed in local time) has been
- * saved for current record.
- * If current record was a special one (RESTART or COMMENT) and
- * noted to be ignored, then the timestamp is saved only if
- * explicitly told to do so with the SET_TIMESTAMPS action flag.
*
* RETURNS:
* 1 if EOF has been reached,
*/
int read_next_sample(int ifd, int action, int curr, char *file, int *rtype, int tab,
struct file_magic *file_magic, struct file_activity *file_actlst,
- struct tm *rectime, struct tm *loctime, int oneof)
+ struct tm *rectime, int oneof)
{
int rc;
char rec_hdr_tmp[MAX_RECORD_HEADER_SIZE];
}
if (action & SET_TIMESTAMPS) {
sa_get_record_timestamp_struct(flags, &record_hdr[curr],
- rectime, loctime);
+ rectime);
}
}
else {
/* Display COMMENT record */
print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
- *rtype, ifd, rectime, loctime, file, tab,
+ *rtype, ifd, rectime, file, tab,
file_magic, &file_hdr, act, fmt[f_position],
endian_mismatch, arch_64);
}
endian_mismatch, arch_64, TRUE);
}
if (action & SET_TIMESTAMPS) {
- sa_get_record_timestamp_struct(flags, &record_hdr[curr],
- rectime, loctime);
+ sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime);
}
}
else {
/* Display RESTART record */
print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
- *rtype, ifd, rectime, loctime, file, tab,
+ *rtype, ifd, rectime, file, tab,
file_magic, &file_hdr, act, fmt[f_position],
endian_mismatch, arch_64);
}
if (read_file_stat_bunch(act, curr, ifd, file_hdr.sa_act_nr, file_actlst,
endian_mismatch, arch_64, file, file_magic, oneof) > 0)
return 2;
- sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime, loctime);
+ sa_get_record_timestamp_struct(flags, &record_hdr[curr], rectime);
}
return 0;
* @rectime Structure where timestamp (expressed in local time or
* in UTC depending on whether options -T/-t have been
* used or not) can be saved for current record.
- * @loctime Structure where timestamp (expressed in local time)
- * can be saved for current record.
*
* RETURNS:
* 0 if no records are concerned in file, and 1 otherwise.
***************************************************************************
*/
int count_file_items(int ifd, char *file, struct file_magic *file_magic,
- struct file_activity *file_actlst, struct tm *rectime,
- struct tm *loctime)
+ struct file_activity *file_actlst, struct tm *rectime)
{
int i, eosaf, rtype;
do {
eosaf = read_next_sample(ifd, IGNORE_RESTART | IGNORE_COMMENT | SET_TIMESTAMPS,
0, file, &rtype, 0, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
if (eosaf)
/* No record to display */
return 0;
}
- while ((tm_start.use && (datecmp(loctime, &tm_start) < 0)) ||
- (tm_end.use && (datecmp(loctime, &tm_end) >= 0)));
+ while ((tm_start.use && (datecmp(rectime, &tm_start, FALSE) < 0)) ||
+ (tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0)));
/*
* Read all the file and determine the maximum number
do {
eosaf = read_next_sample(ifd, IGNORE_RESTART | IGNORE_COMMENT | SET_TIMESTAMPS,
0, file, &rtype, 0, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
if (eosaf ||
- (tm_end.use && (datecmp(loctime, &tm_end) >= 0)))
+ (tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0)))
/* End of data file or end time exceeded */
break;
}
while ((rtype == R_RESTART) || (rtype == R_COMMENT));
}
- while (!eosaf && !(tm_end.use && (datecmp(loctime, &tm_end) >= 0)));
+ while (!eosaf && !(tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0)));
/* Rewind file */
seek_file_position(ifd, DO_RESTORE);
* @rectime Structure where timestamp (expressed in local time or
* in UTC depending on whether options -T/-t have been
* used or not) can be saved for current record.
- * @loctime Structure where timestamp (expressed in local time)
- * can be saved for current record.
* @views_per_row Default number of views displayed on a single row.
*
* OUT:
*/
int get_svg_graph_nr(int ifd, char *file, struct file_magic *file_magic,
struct file_activity *file_actlst, struct tm *rectime,
- struct tm *loctime, int *views_per_row, int *nr_act_dispd)
+ int *views_per_row, int *nr_act_dispd)
{
int i, n, p, tot_g_nr = 0;
*nr_act_dispd = 0;
/* Count items in file */
- if (!count_file_items(ifd, file, file_magic, file_actlst, rectime, loctime))
+ if (!count_file_items(ifd, file, file_magic, file_actlst, rectime))
/* No record to display => No graph */
return 0;
* @rectime Structure where timestamp (expressed in local time
* or in UTC depending on whether options -T/-t have
* been used or not) has been saved for current record.
- * @loctime Structure where timestamp (expressed in local time)
- * has been saved for current record.
* @reset_cd TRUE if static cross_day variable should be reset.
* @act_id Activity to display (only for formats where
* activities are displayed one at a time) or
*/
int generic_write_stats(int curr, int use_tm_start, int use_tm_end, int reset,
long *cnt, void *parm, struct tm *rectime,
- struct tm *loctime, int reset_cd, unsigned int act_id)
+ int reset_cd, unsigned int act_id)
{
int i;
unsigned long long dt, itv;
cross_day = TRUE;
}
- if (cross_day) {
- /*
- * This is necessary if we want to properly handle something like:
- * sar -s time_start -e time_end with
- * time_start(day D) > time_end(day D+1)
- */
- loctime->tm_hour += 24;
- }
-
/* Check time (2) */
- if (use_tm_start && (datecmp(loctime, &tm_start) < 0))
+ if (use_tm_start && (datecmp(rectime, &tm_start, cross_day) < 0))
/* it's too soon... */
return 0;
get_itv_value(&record_hdr[curr], &record_hdr[!curr], &itv);
/* Check time (3) */
- if (use_tm_end && (datecmp(loctime, &tm_end) > 0)) {
+ if (use_tm_end && (datecmp(rectime, &tm_end, cross_day) > 0)) {
/* It's too late... */
*cnt = 0;
return 0;
* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @file Name of file being read.
* @file_magic file_magic structure filled with file magic header data.
*
*/
void rw_curr_act_stats(int ifd, int *curr, long *cnt, int *eosaf,
unsigned int act_id, int *reset, struct file_activity *file_actlst,
- struct tm *rectime, struct tm *loctime, char *file,
+ struct tm *rectime, char *file,
struct file_magic *file_magic)
{
int rtype;
/* Display <count> lines of stats */
*eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_CPU_NR,
*curr, file, &rtype, 0, file_magic,
- file_actlst, rectime, loctime, UEOF_STOP);
+ file_actlst, rectime, UEOF_STOP);
if (!*eosaf && (rtype != R_RESTART) && (rtype != R_COMMENT)) {
next = generic_write_stats(*curr, tm_start.use, tm_end.use, *reset, cnt,
- NULL, rectime, loctime, reset_cd, act_id);
+ NULL, rectime, reset_cd, act_id);
reset_cd = 0;
if (next) {
* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @file Name of file being read.
* @file_magic file_magic structure filled with file magic header data.
* @g_nr Number of graphs already displayed (for all activities).
*/
void display_curr_act_graphs(int ifd, int *curr, long *cnt, int *eosaf,
int p, int *reset, struct file_activity *file_actlst,
- struct tm *rectime, struct tm *loctime,
- char *file, struct file_magic *file_magic, int *g_nr,
- int nr_act_dispd)
+ struct tm *rectime, char *file, struct file_magic *file_magic,
+ int *g_nr, int nr_act_dispd)
{
struct svg_parm parm;
int rtype;
do {
*eosaf = read_next_sample(ifd, IGNORE_RESTART | IGNORE_COMMENT | SET_TIMESTAMPS,
*curr, file, &rtype, 0, file_magic,
- file_actlst, rectime, loctime, UEOF_CONT);
+ file_actlst, rectime, UEOF_CONT);
if (!*eosaf && (rtype != R_COMMENT) && (rtype != R_RESTART)) {
next = generic_write_stats(*curr, tm_start.use, tm_end.use, *reset, cnt,
- &parm, rectime, loctime, reset_cd, act[p]->id);
+ &parm, rectime, reset_cd, act[p]->id);
reset_cd = 0;
if (next) {
/*
do {
*eosaf = read_next_sample(ifd, IGNORE_RESTART | IGNORE_COMMENT | SET_TIMESTAMPS,
*curr, file, &rtype, 0, file_magic,
- file_actlst, rectime, loctime, UEOF_CONT);
+ file_actlst, rectime, UEOF_CONT);
}
while (!*eosaf && ((rtype == R_RESTART) || (rtype == R_COMMENT)));
* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @dparm PCP archive file name.
***************************************************************************
*/
void logic1_display_loop(int ifd, char *file, struct file_activity *file_actlst,
- struct file_magic *file_magic, struct tm *rectime,
- struct tm *loctime, void *dparm)
+ struct file_magic *file_magic, struct tm *rectime, void *dparm)
{
int curr, rtype, tab = 0;
int eosaf, next, reset = FALSE;
if (CREATE_ITEM_LIST(fmt[f_position]->options)) {
/* Count items in file (e.g. for PCP output) */
- if (!count_file_items(ifd, file, file_magic, file_actlst, rectime, loctime))
+ if (!count_file_items(ifd, file, file_magic, file_actlst, rectime))
/* No record to display */
return;
}
do {
eosaf = read_next_sample(ifd, ign_flag, 0, file,
&rtype, tab, file_magic, file_actlst,
- rectime, loctime, UEOF_STOP);
+ rectime, UEOF_STOP);
}
while (!eosaf && ((rtype == R_RESTART) || (rtype == R_COMMENT) ||
- (tm_start.use && (datecmp(loctime, &tm_start) < 0)) ||
- (tm_end.use && (datecmp(loctime, &tm_end) >= 0))));
+ (tm_start.use && (datecmp(rectime, &tm_start, FALSE) < 0)) ||
+ (tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0))));
curr = 1;
cnt = count;
do {
eosaf = read_next_sample(ifd, ign_flag, curr, file,
&rtype, tab, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
if (!eosaf && (rtype != R_COMMENT) && (rtype != R_RESTART)) {
if (*fmt[f_position]->f_statistics) {
/* next is set to 1 when we were close enough to desired interval */
next = generic_write_stats(curr, tm_start.use, tm_end.use, reset,
- &cnt, &tab, rectime, loctime,
- FALSE, ALL_ACTIVITIES);
+ &cnt, &tab, rectime, FALSE, ALL_ACTIVITIES);
if (next) {
curr ^= 1;
do {
eosaf = read_next_sample(ifd, ign_flag, curr, file,
&rtype, tab, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
}
while (!eosaf && (rtype != R_RESTART));
}
do {
eosaf = read_next_sample(ifd, IGNORE_COMMENT, 0,
file, &rtype, tab, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
}
while (!eosaf);
do {
eosaf = read_next_sample(ifd, IGNORE_RESTART, 0,
file, &rtype, tab, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT);
+ rectime, UEOF_CONT);
}
while (!eosaf);
* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @dparm Unused here.
***************************************************************************
*/
void logic2_display_loop(int ifd, char *file, struct file_activity *file_actlst,
- struct file_magic *file_magic, struct tm *rectime,
- struct tm *loctime, void *dparm)
+ struct file_magic *file_magic, struct tm *rectime, void *dparm)
{
int i, p;
int curr = 1, rtype;
do {
if (read_next_sample(ifd, IGNORE_NOTHING, 0,
file, &rtype, 0, file_magic, file_actlst,
- rectime, loctime, UEOF_STOP))
+ rectime, UEOF_STOP))
/* End of sa data file */
return;
}
while ((rtype == R_RESTART) || (rtype == R_COMMENT) ||
- (tm_start.use && (datecmp(loctime, &tm_start) < 0)) ||
- (tm_end.use && (datecmp(loctime, &tm_end) >= 0)));
+ (tm_start.use && (datecmp(rectime, &tm_start, FALSE) < 0)) ||
+ (tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0)));
/* Save the first stats collected. Used for example in next_slice() function */
copy_structures(act, id_seq, record_hdr, 2, 0);
*/
rw_curr_act_stats(ifd, &curr, &cnt, &eosaf,
ALL_ACTIVITIES, &reset, file_actlst,
- rectime, loctime, file, file_magic);
+ rectime, file, file_magic);
}
else {
/* For each requested activity... */
if (!HAS_MULTIPLE_OUTPUTS(act[p]->options)) {
rw_curr_act_stats(ifd, &curr, &cnt, &eosaf,
act[p]->id, &reset, file_actlst,
- rectime, loctime, file, file_magic);
+ rectime, file, file_magic);
}
else {
unsigned int optf, msk;
rw_curr_act_stats(ifd, &curr, &cnt, &eosaf,
act[p]->id, &reset, file_actlst,
- rectime, loctime, file,
+ rectime, file,
file_magic);
act[p]->opt_flags = optf;
}
do {
eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_CPU_NR,
curr, file, &rtype, 0, file_magic,
- file_actlst, rectime, loctime, UEOF_STOP);
+ file_actlst, rectime, UEOF_STOP);
}
while (!eosaf && (rtype != R_RESTART));
}
*/
if (!eosaf && (record_hdr[curr].record_type == R_RESTART)) {
print_special_record(&record_hdr[curr], flags, &tm_start, &tm_end,
- R_RESTART, ifd, rectime, loctime, file, 0,
+ R_RESTART, ifd, rectime, file, 0,
file_magic, &file_hdr, act, fmt[f_position],
endian_mismatch, arch_64);
}
* @rectime Structure where timestamp (expressed in local time or in UTC
* depending on whether options -T/-t have been used or not) can
* be saved for current record.
- * @loctime Structure where timestamp (expressed in local time) can be
- * saved for current record.
* @dparm Unused here.
***************************************************************************
*/
void svg_display_loop(int ifd, char *file, struct file_activity *file_actlst,
- struct file_magic *file_magic, struct tm *rectime,
- struct tm *loctime, void *dparm)
+ struct file_magic *file_magic, struct tm *rectime, void *dparm)
{
struct svg_hdr_parm parm;
int i, p;
* Result may be 0. In this case, "No data" will be displayed instead of the graphs.
*/
graph_nr = get_svg_graph_nr(ifd, file, file_magic,
- file_actlst, rectime, loctime, &views_per_row,
- &nr_act_dispd);
+ file_actlst, rectime, &views_per_row, &nr_act_dispd);
if (SET_CANVAS_HEIGHT(flags)) {
/*
do {
if (read_next_sample(ifd, IGNORE_RESTART | IGNORE_COMMENT, 0,
file, &rtype, 0, file_magic, file_actlst,
- rectime, loctime, UEOF_CONT))
+ rectime, UEOF_CONT))
{
/* End of sa data file: No views displayed */
parm.graph_nr = 0;
}
}
while ((rtype == R_RESTART) || (rtype == R_COMMENT) ||
- (tm_start.use && (datecmp(loctime, &tm_start) < 0)) ||
- (tm_end.use && (datecmp(loctime, &tm_end) >= 0)));
+ (tm_start.use && (datecmp(rectime, &tm_start, FALSE) < 0)) ||
+ (tm_end.use && (datecmp(rectime, &tm_end, FALSE) >= 0)));
/* Save the first stats collected. Used for example in next_slice() function */
copy_structures(act, id_seq, record_hdr, 2, 0);
if (!HAS_MULTIPLE_OUTPUTS(act[p]->options)) {
display_curr_act_graphs(ifd, &curr, &cnt, &eosaf,
p, &reset, file_actlst,
- rectime, loctime, file,
+ rectime, file,
file_magic, &g_nr, nr_act_dispd);
}
else {
act[p]->opt_flags &= (0xffffff00 + msk);
display_curr_act_graphs(ifd, &curr, &cnt, &eosaf,
p, &reset, file_actlst,
- rectime, loctime, file,
+ rectime, file,
file_magic, &g_nr, nr_act_dispd);
act[p]->opt_flags = optf;
}
{
struct file_magic file_magic;
struct file_activity *file_actlst = NULL;
- struct tm rectime, loctime;
+ struct tm rectime;
int ifd, ignore, tab = 0;
/* Prepare file for reading and read its headers */
/* Call function corresponding to selected output format */
if (*fmt[f_position]->f_display) {
(*fmt[f_position]->f_display)(ifd, dfile, file_actlst, &file_magic,
- &rectime, &loctime, pcparchive);
+ &rectime, pcparchive);
}
close(ifd);