*/
struct activity cpu_act = {
.id = A_CPU,
- .options = AO_COLLECTED + AO_VOLATILE + AO_MULTIPLE_OUTPUTS +
+ .options = AO_COLLECTED + AO_MULTIPLE_OUTPUTS +
AO_GRAPH_PER_ITEM,
.magic = ACTIVITY_MAGIC_BASE,
.group = G_DEFAULT,
/* CPU frequency */
struct activity pwr_cpufreq_act = {
.id = A_PWR_CPUFREQ,
- .options = AO_VOLATILE + AO_GRAPH_PER_ITEM,
+ .options = AO_GRAPH_PER_ITEM,
.magic = ACTIVITY_MAGIC_BASE,
.group = G_POWER,
#ifdef SOURCE_SADC
/* CPU weighted frequency */
struct activity pwr_wghfreq_act = {
.id = A_PWR_WGHFREQ,
- .options = AO_VOLATILE + AO_MATRIX,
+ .options = AO_MATRIX,
.magic = ACTIVITY_MAGIC_BASE,
.group = G_POWER,
#ifdef SOURCE_SADC
* | |
* | record_header structure |
* | |
+ * |-- --|
+ * |(__nr_t) * 0+ |
* |-- | * <count>
* | |
- * | Statistics structures...(*) |
+ * | Statistics structures... |
* | |
* |-- --|
*
- * (*)Note: If it's a special record, we may find a comment instead of
- * statistics (R_COMMENT record type) or, if it's a R_RESTART record type,
- * <sa_nr_vol_act> structures (of type file_activity) for the volatile
- * activities.
+ * Note: A record_header structure is followed by 0+ __nr_t values giving
+ * the number of statistics structures for activities whose number of items
+ * may vary (ie. activities having a positive f_count_index value).
+ * If the record header's type is R_COMMENT then we find only a comment
+ * following the record_header structure.
+ * If the record_header's type is R_RESTART then we find only the number of CPU
+ * (of type __nr_t) of the machine following the record_header structure.
***************************************************************************
*/
* Number of jiffies per second.
*/
unsigned long sa_hz __attribute__ ((aligned (8)));
- /*
- * Number of CPU items (1 .. CPU_NR + 1) for the last sample in file.
- */
- unsigned int sa_last_cpu_nr __attribute__ ((aligned (8)));
/*
* Number of [online or offline] CPU (1 .. CPU_NR + 1)
* when the datafile has been created.
* When reading a datafile, this value is updated whenever
* a RESTART record is found.
*/
- unsigned int sa_cpu_nr;
+ unsigned int sa_cpu_nr __attribute__ ((aligned (8)));
/*
* Number of activities saved in file.
*/
unsigned int sa_act_nr;
- /*
- * Number of volatile activities in file. This is the number of
- * file_activity structures saved after each restart mark in file.
- */
- unsigned int sa_vol_act_nr;
/*
* Current year.
*/
#define FILE_HEADER_SIZE (sizeof(struct file_header))
#define FILE_HEADER_ULL_NR 1 /* Nr of unsigned long long in file_header structure */
#define FILE_HEADER_UL_NR 1 /* Nr of unsigned long in file_header structure */
-#define FILE_HEADER_U_NR 13 /* Nr of [unsigned] int in file_header structure */
+#define FILE_HEADER_U_NR 11 /* Nr of [unsigned] int in file_header structure */
/* The values below are used for sanity check */
#define MIN_FILE_HEADER_SIZE 0
#define MAX_FILE_HEADER_SIZE 8192
*/
#define AO_SELECTED 0x02
/*
- * When appending data to a file, the number of items (for every activity)
- * is forced to that of the file (number of network interfaces, serial lines,
- * etc.) Exceptions are volatile activities (like A_CPU) whose number of items
- * is related to the number of CPUs: If current machine has a different number
- * of CPU than that of the file (but is equal to sa_last_cpu_nr) then data
- * will be appended with a number of items equal to that of the machine.
- */
-#define AO_VOLATILE 0x04
-/*
+ * 0x04: Unused.
* 0x08: Unused.
*/
/*
#define IS_COLLECTED(m) (((m) & AO_COLLECTED) == AO_COLLECTED)
#define IS_SELECTED(m) (((m) & AO_SELECTED) == AO_SELECTED)
-#define IS_VOLATILE(m) (((m) & AO_VOLATILE) == AO_VOLATILE)
#define CLOSE_MARKUP(m) (((m) & AO_CLOSE_MARKUP) == AO_CLOSE_MARKUP)
#define HAS_MULTIPLE_OUTPUTS(m) (((m) & AO_MULTIPLE_OUTPUTS) == AO_MULTIPLE_OUTPUTS)
#define ONE_GRAPH_PER_ITEM(m) (((m) & AO_GRAPH_PER_ITEM) == AO_GRAPH_PER_ITEM)
struct file_header *, struct activity * [], struct report_format *, int, int);
void read_file_stat_bunch
(struct activity * [], int, int, int, struct file_activity *, int, int);
+__nr_t read_new_cpu_nr
+ (int, char *, struct file_magic *, int, int);
int read_record_hdr
(int, void *, struct record_header *, struct file_header *, int, int);
-__nr_t read_vol_act_structures
- (int, struct activity * [], char *, struct file_magic *, unsigned int, int, int);
-int reallocate_vol_act_structures
- (struct activity * [], unsigned int, unsigned int);
void remap_struct
(unsigned int [], unsigned int [], void *, unsigned int);
void replace_nonprintable_char
unsigned int hdr_types_nr[] = {FILE_HEADER_ULL_NR, FILE_HEADER_UL_NR, FILE_HEADER_U_NR};
unsigned int act_types_nr[] = {FILE_ACTIVITY_ULL_NR, FILE_ACTIVITY_UL_NR, FILE_ACTIVITY_U_NR};
unsigned int rec_types_nr[] = {RECORD_HEADER_ULL_NR, RECORD_HEADER_UL_NR, RECORD_HEADER_U_NR};
+unsigned int nr_types_nr[] = {0, 0, 1};
/*
***************************************************************************
if (fal->size > act[p]->msize) {
act[p]->msize = fal->size;
}
- /*
- * NOTA BENE:
- * If current activity is a volatile one then fal->nr is the
- * number of items (CPU at the present time as only CPU related
- * activities are volatile today) for the statistics located
- * between the start of the data file and the first restart mark.
- * Volatile activities have a number of items which can vary
- * in file. In this case, a RESTART record is followed by the
- * volatile activity structures.
- */
+
act[p]->nr = fal->nr;
act[p]->nr2 = fal->nr2;
act[p]->fsize = fal->size;
/*
***************************************************************************
- * Set number of items for current volatile activity and reallocate its
- * structures accordingly.
- * NB: As only activities related to CPU can be volatile, the number of
- * items corresponds in fact to the number of CPU.
- *
- * IN:
- * @act Array of activities.
- * @act_nr Number of items for current volatile activity.
- * @act_id Activity identification for current volatile activity.
- *
- * RETURN:
- * -1 if unknown activity and 0 otherwise.
- ***************************************************************************
- */
-int reallocate_vol_act_structures(struct activity *act[], unsigned int act_nr,
- unsigned int act_id)
-{
- int j, p;
-
- if ((p = get_activity_position(act, act_id, RESUME_IF_NOT_FOUND)) < 0)
- /* Ignore unknown activity */
- return -1;
-
- act[p]->nr = act_nr;
-
- for (j = 0; j < 3; j++) {
- SREALLOC(act[p]->buf[j], void,
- (size_t) act[p]->msize * (size_t) act[p]->nr * (size_t) act[p]->nr2);
- }
-
- return 0;
-}
-
-/*
- ***************************************************************************
- * Read the volatile activities structures following a RESTART record.
- * Then set number of items for each corresponding activity and reallocate
- * structures.
+ * Read the new number of CPU saved after a RESTART record.
*
* IN:
* @ifd Input file descriptor.
- * @act Array of activities.
* @file Name of file being read.
* @file_magic file_magic structure filled with file magic header data.
- * @vol_act_nr Number of volatile activities structures to read.
* @endian_mismatch
* TRUE if file's data don't match current machine's endianness.
* @arch_64 TRUE if file's data come from a 64 bit machine.
*
* RETURNS:
- * New number of items.
- *
- * NB: As only activities related to CPU can be volatile, the new number of
- * items corresponds in fact to the new number of CPU.
+ * New number of CPU.
***************************************************************************
*/
-__nr_t read_vol_act_structures(int ifd, struct activity *act[], char *file,
- struct file_magic *file_magic,
- unsigned int vol_act_nr, int endian_mismatch,
- int arch_64)
+__nr_t read_new_cpu_nr(int ifd, char *file, struct file_magic *file_magic,
+ int endian_mismatch, int arch_64)
{
- struct file_activity file_act;
- int item_nr = 0;
- int i, rc;
-
- for (i = 0; i < vol_act_nr; i++) {
+ __nr_t cpu_nr;
- sa_fread(ifd, &file_act, FILE_ACTIVITY_SIZE, HARD_SIZE);
+ sa_fread(ifd, &cpu_nr, sizeof(__nr_t), HARD_SIZE);
- /* Normalize endianness for file_activity structures */
- if (endian_mismatch) {
- swap_struct(act_types_nr, &file_act, arch_64);
- }
-
- if (file_act.id) {
- rc = reallocate_vol_act_structures(act, file_act.nr, file_act.id);
- if ((rc == 0) && !item_nr) {
- item_nr = file_act.nr;
- }
- }
- /* else ignore empty structures that may exist */
+ /* Normalize endianness for file_activity structures */
+ if (endian_mismatch) {
+ nr_types_nr[2] = 1;
+ swap_struct(nr_types_nr, &cpu_nr, arch_64);
}
- if (!item_nr) {
- /* All volatile activities structures cannot be empty */
+ if (!cpu_nr) {
+ /* CPU number cannot be zero */
handle_invalid_sa_file(&ifd, file_magic, file, 0);
}
- return item_nr;
+ return cpu_nr;
}
/*
if (rtype == R_RESTART) {
/* Read new cpu number following RESTART record */
- file_hdr->sa_cpu_nr = read_vol_act_structures(ifd, act, file, file_magic,
- file_hdr->sa_vol_act_nr,
- endian_mismatch, arch_64);
+ file_hdr->sa_cpu_nr = read_new_cpu_nr(ifd, file, file_magic,
+ endian_mismatch, arch_64);
if (!dp)
return 0;
strncpy(file_hdr->sa_machine, f_hdr->sa_machine, UTSNAME_LEN);
file_hdr->sa_machine[UTSNAME_LEN - 1] = '\0';
/* The last two values below will be updated later */
- file_hdr->sa_vol_act_nr = 0;
- file_hdr->sa_last_cpu_nr = 0;
+// file_hdr->sa_vol_act_nr = 0;
+// file_hdr->sa_last_cpu_nr = 0;
}
/*
struct file_header *file_hdr, int previous_format,
struct file_activity **file_actlst, unsigned int vol_id_seq[])
{
- int i, j, n, p;
+ int i, n, p;
unsigned int a_cpu = FALSE;
void *buffer = NULL;
struct file_activity *fal;
SREALLOC(*file_actlst, struct file_activity, FILE_ACTIVITY_SIZE * file_hdr->sa_act_nr);
fal = *file_actlst;
- j = 0;
+// j = 0;
for (i = 0; i < file_hdr->sa_act_nr; i++, fal++) {
sa_fread(fd, fal, FILE_ACTIVITY_SIZE, HARD_SIZE);
if ((p = get_activity_position(act, fal->id, RESUME_IF_NOT_FOUND)) >= 0) {
/* This is a known activity, maybe with an unknown format */
- if (IS_VOLATILE(act[p]->options) && previous_format) {
+// if (IS_VOLATILE(act[p]->options) && previous_format) {
/*
* Current activity is known by current version
* as a volatile one: So increment the number of
* for old format data files, since up-to-date
* format data files already have the right value here).
*/
- file_hdr->sa_vol_act_nr += 1;
+// file_hdr->sa_vol_act_nr += 1;
/*
* Create the sequence of volatile activities.
* since this sequence already exists following
* the RESTART record.
*/
- vol_id_seq[j++] = act[p]->id;
- }
+// vol_id_seq[j++] = act[p]->id;
+// }
if (fal->id == A_CPU) {
/*
* activities. The number of CPU is a constant
* all along the file.
*/
- if (previous_format) {
- file_hdr->sa_last_cpu_nr = fal->nr;
- }
+// if (previous_format) {
+// file_hdr->sa_last_cpu_nr = fal->nr;
+// }
a_cpu = TRUE;
}
struct file_header *file_hdr, int previous_format,
unsigned int vol_id_seq[])
{
+#if 0
int i, p;
struct file_activity file_act;
}
fprintf(stderr, "R");
-
+#endif
return 0;
}
char comment[MAX_COMMENT_LEN];
unsigned int id_seq[NR_ACT];
-unsigned int vol_id_seq[NR_ACT];
extern unsigned int hdr_types_nr[];
extern unsigned int act_types_nr[];
/* OK, now fill the header */
file_hdr.sa_act_nr = get_activity_nr(act, AO_COLLECTED, COUNT_ACTIVITIES);
- file_hdr.sa_vol_act_nr = get_activity_nr(act, AO_COLLECTED + AO_VOLATILE,
- COUNT_ACTIVITIES);
file_hdr.sa_day = rectime.tm_mday;
file_hdr.sa_month = rectime.tm_mon;
file_hdr.sa_year = rectime.tm_year;
file_hdr.act_size = FILE_ACTIVITY_SIZE;
file_hdr.rec_size = RECORD_HEADER_SIZE;
- /*
- * This is a new file (or stdout): Field sa_last_cpu_nr is set to the number
- * of CPU items of the machine (1 .. CPU_NR + 1).
- * A_CPU activity is always collected, hence its number of items is
- * always counted (in sa_sys_init()).
- */
- file_hdr.sa_last_cpu_nr = act[get_activity_position(act, A_CPU, EXIT_IF_NOT_FOUND)]->nr;
/*
* This is a new file (or stdout): Set sa_cpu_nr field to the number
* of CPU of the machine (1 .. CPU_NR + 1). This is the number of CPU, whether
if (write_all(fd, &file_act, FILE_ACTIVITY_SIZE)
!= FILE_ACTIVITY_SIZE)
goto write_error;
-
- /* Create sequence of volatile activities */
- if (IS_VOLATILE(act[p]->options)) {
- vol_id_seq[i] = act[p]->id;
- }
}
}
/*
***************************************************************************
- * Write the volatile activity structures following each restart mark.
- * sa_vol_act_nr structures have to be written.
- * Note that volatile activities written after the restart marks may be
- * different within the same file if different versions of sysstat have been
- * used to create the file and then to append data to it.
+ * Write the new number of CPU after the RESTART record in file.
*
* IN:
* @ofd Output file descriptor.
***************************************************************************
*/
-void write_vol_act_structures(int ofd)
+void write_new_cpu_nr(int ofd)
{
- struct file_activity file_act;
- int i, p;
-
- memset(&file_act, 0, FILE_ACTIVITY_SIZE);
+ int p;
+ __nr_t cpu_nr;
- for (i = 0; i < file_hdr.sa_vol_act_nr; i++) {
-
- if (!vol_id_seq[i]) {
- /*
- * Write an empty structure when current sysstat
- * version knows fewer volatile activities than
- * the number saved in file's header.
- */
- file_act.id = file_act.nr = 0;
- }
- else {
- p = get_activity_position(act, vol_id_seq[i], EXIT_IF_NOT_FOUND);
-
- /*
- * All the fields in file_activity structure are not used.
- * In particular, act[p]->nr2 is left unmodified.
- */
- file_act.id = act[p]->id;
- file_act.nr = act[p]->nr;
- }
+ p = get_activity_position(act, A_CPU, EXIT_IF_NOT_FOUND);
+ cpu_nr = act[p]->nr;
- if (write_all(ofd, &file_act, FILE_ACTIVITY_SIZE) != FILE_ACTIVITY_SIZE) {
- p_write_error();
- }
+ if (write_all(ofd, &cpu_nr, sizeof(__nr_t)) != sizeof(__nr_t)) {
+ p_write_error();
}
}
}
if (rtype == R_RESTART) {
- /* Also write the volatile activities structures */
- write_vol_act_structures(ofd);
+ /* Also write the new number of CPU */
+ write_new_cpu_nr(ofd);
}
else if (rtype == R_COMMENT) {
/* Also write the comment */
}
}
-/*
- ***************************************************************************
- * Rewrite file's header. Done when number of CPU has changed.
- *
- * IN:
- * @ofd Output file descriptor.
- * @fpos Position in file where header structure has to be written.
- * @file_magic File magic structure.
- ***************************************************************************
- */
-void rewrite_file_hdr(int *ofd, off_t fpos, struct file_magic *file_magic)
-{
- /* Remove O_APPEND status flag */
- if (fcntl(*ofd, F_SETFL, 0) < 0) {
- perror("fcntl");
- exit(2);
- }
-
- /* Now rewrite file's header with its new CPU number value */
- if (lseek(*ofd, fpos, SEEK_SET) < fpos) {
- perror("lseek");
- exit(2);
- }
-
- if (write_all(*ofd, &file_hdr, FILE_HEADER_SIZE) != FILE_HEADER_SIZE) {
- p_write_error();
- }
-
- /* Restore O_APPEND status flag */
- if (fcntl(*ofd, F_SETFL, O_APPEND) < 0) {
- perror("fcntl");
- exit(2);
- }
-}
-
/*
***************************************************************************
* Create a system activity daily data file.
struct file_activity file_act[NR_ACT];
struct tm rectime = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL};
ssize_t sz;
- off_t fpos;
- int i, j, p;
+ int i, p;
if (!ofile[0])
return;
handle_invalid_sa_file(ofd, &file_magic, ofile, sz);
}
- /*
- * Save current file position.
- * Needed later to update sa_last_cpu_nr.
- */
- if ((fpos = lseek(*ofd, 0, SEEK_CUR)) < 0) {
- perror("lseek");
- exit(2);
- }
-
/* Read file standard header */
if ((sz = read(*ofd, &file_hdr, FILE_HEADER_SIZE)) != FILE_HEADER_SIZE)
goto append_error;
}
/* OK: It's a true system activity file */
- if (!file_hdr.sa_act_nr || (file_hdr.sa_act_nr > NR_ACT) ||
- (file_hdr.sa_vol_act_nr > NR_ACT))
+ if (!file_hdr.sa_act_nr || (file_hdr.sa_act_nr > NR_ACT))
/*
- * No activities at all or at least one unknown activity,
- * or too many volatile activities:
+ * No activities at all or at least one unknown activity:
* Cannot append data to such a file.
*/
goto append_error;
id_seq[i] = 0;
}
- j = 0;
-
for (i = 0; i < file_hdr.sa_act_nr; i++) {
p = get_activity_position(act, file_act[i].id, EXIT_IF_NOT_FOUND);
/*
* Force number of items (serial lines, network interfaces...)
* and sub-items to that of the file, and reallocate structures.
- * Exceptions are volatile activities, for which number of items
- * is kept unmodified unless its value was zero (in this case,
- * it is also forced to the value of the file).
- * Also keep in mind that the file cannot contain more than
- * sa_vol_act_nr volatile activities.
*/
- if (!IS_VOLATILE(act[p]->options) || !act[p]->nr || (j >= file_hdr.sa_vol_act_nr)) {
- act[p]->nr = file_act[i].nr;
- }
- else {
- vol_id_seq[j++] = file_act[i].id;
- }
+ act[p]->nr = file_act[i].nr;
act[p]->nr2 = file_act[i].nr2;
SREALLOC(act[p]->_buf0, void,
(size_t) act[p]->msize * (size_t) act[p]->nr * (size_t) act[p]->nr2);
act[p]->options |= AO_COLLECTED;
}
- while (j < file_hdr.sa_vol_act_nr) {
- vol_id_seq[j++] = 0;
- }
-
- p = get_activity_position(act, A_CPU, EXIT_IF_NOT_FOUND);
- if (!IS_COLLECTED(act[p]->options))
- /* A_CPU activity may not exist in file */
- return;
-
- if (act[p]->nr != file_hdr.sa_last_cpu_nr) {
- if (restart_mark) {
- /*
- * We are inserting a restart mark, and current machine
- * has a different number of CPU than that saved in file,
- * so update sa_last_cpu_nr in file's header and rewrite it.
- */
- file_hdr.sa_last_cpu_nr = act[p]->nr;
- rewrite_file_hdr(ofd, fpos, &file_magic);
- }
- else {
- /*
- * Current number of cpu items (for current system)
- * doesn't match number of cpu items of the last sample
- * saved in file.
- */
- goto append_error;
- }
- }
-
return;
append_error:
}
}
-/*
- ***************************************************************************
- * Save or restore number of items for all known activities.
- *
- * IN:
- * @save_act_nr Array containing number of items to restore for each
- * activity.
- * @action DO_SAVE to save number of items, or DO_RESTORE to restore.
- *
- * OUT:
- * @save_act_nr Array containing number of items saved for each activity.
- ***************************************************************************
- */
-void sr_act_nr(__nr_t save_act_nr[], int action)
-{
- int i;
-
- if (action == DO_SAVE) {
- /* Save number of items for all activities */
- for (i = 0; i < NR_ACT; i++) {
- save_act_nr[i] = act[i]->nr;
- }
- }
- else if (action == DO_RESTORE) {
- /*
- * Restore number of items for all activities
- * and reallocate structures accordingly.
- */
- for (i = 0; i < NR_ACT; i++) {
- if (save_act_nr[i] > 0) {
- reallocate_vol_act_structures(act, save_act_nr[i],
- act[i]->id);
- }
- }
- }
-}
-
/*
***************************************************************************
* Read next sample statistics. If it's a special record (R_RESTART or
if (action & IGNORE_RESTART) {
/*
* Ignore RESTART record (don't display it)
- * but anyway we have to reallocate volatile
- * activities structures (unless we don't want to
- * do it now).
+ * but anyway we have to read the CPU number that follows it
+ * (unless we don't want to do it now).
*/
- if (!(action & DONT_READ_VOLATILE)) {
- read_vol_act_structures(ifd, act, file, file_magic,
- file_hdr.sa_vol_act_nr,
- endian_mismatch, arch_64);
+ if (!(action & DONT_READ_CPU_NR)) {
+ file_hdr.sa_cpu_nr = read_new_cpu_nr(ifd, file, file_magic,
+ endian_mismatch, arch_64);
}
if (action & SET_TIMESTAMPS) {
sa_get_record_timestamp_struct(flags, &record_hdr[curr],
***************************************************************************
* Compute the number of rows that will contain SVG views. Usually only one
* view is displayed on a row, unless the "packed" option has been entered.
- * Each activity selected may have several views. Moreover we have to take
- * into account volatile activities (eg. CPU) for which the number of views
- * will depend on the highest number of items (eg. maximum number of CPU)
- * saved in the file.
+ * Each activity selected may have several views. Moreover some activities
+ * may have a number of items that vary within the file: In this case,
+ * the number of views will depend on the highest number of items saved in
+ * the file.
*
* IN:
* @ifd File descriptor of input file.
int i, n, p, eosaf;
int rtype, new_tot_g_nr, tot_g_nr = 0;
off_t fpos;
- __nr_t save_act_nr[NR_ACT] = {0};
- /* Save current file position and items number */
+ /* Save current file position */
if ((fpos = lseek(ifd, 0, SEEK_CUR)) < 0) {
perror("lseek");
exit(2);
}
- sr_act_nr(save_act_nr, DO_SAVE);
/* Init total number of views for each activity */
for (i = 0; i < NR_ACT; i++) {
break;
/*
- * If we have found a RESTART record then we have also read the list of volatile
- * activities following it, reallocated the structures and changed the number of
- * items (act[p]->nr) for those volatile activities. So loop again to compute
- * the new total number of graphs.
+ * If we have found a RESTART record then we have also read the new number of
+ * CPU that follows and saved it in file_header's sa_cpu_nr field.
+ * FIXME: Loop again to compute the new total number of graphs.
*/
}
while (rtype == R_RESTART);
- /* Rewind file and restore items number */
+ /* Rewind file */
if (lseek(ifd, fpos, SEEK_SET) < fpos) {
perror("lseek");
exit(2);
}
- sr_act_nr(save_act_nr, DO_RESTORE);
if (*views_per_row > MAX_VIEWS_ON_A_ROW) {
*views_per_row = MAX_VIEWS_ON_A_ROW;
do {
/* Display <count> lines of stats */
- *eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_VOLATILE,
+ *eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_CPU_NR,
*curr, file, &rtype, 0, file_magic,
file_actlst, rectime, loctime);
* saved for current record.
* @file Name of file being read.
* @file_magic file_magic structure filled with file magic header data.
- * @save_act_nr Array where the number of volatile activities are saved
- * for current position in file.
* @g_nr Number of graphs already displayed (for all activities).
*
* OUT:
void display_curr_act_graphs(int ifd, off_t fpos, 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,
- __nr_t save_act_nr[], int *g_nr)
+ char *file, struct file_magic *file_magic, int *g_nr)
{
struct svg_parm parm;
int rtype;
int next, reset_cd;
- /* Rewind file... */
+ /* Rewind file */
if (lseek(ifd, fpos, SEEK_SET) < fpos) {
perror("lseek");
exit(2);
}
- /*
- * ... and restore number of items for volatile activities
- * for this position in file.
- */
- sr_act_nr(save_act_nr, DO_RESTORE);
/*
* Restore the first stats collected.
{
int curr, tab = 0, rtype;
int eosaf, next, reset = FALSE;
- __nr_t save_act_nr[NR_ACT] = {0};
long cnt = 1;
off_t fpos;
perror("lseek");
exit(2);
}
- /* Save number of activities items for current file position */
- sr_act_nr(save_act_nr, DO_SAVE);
/* Print header (eg. XML file header) */
if (*fmt[f_position]->f_header) {
(*fmt[f_position]->f_statistics)(&tab, F_END);
}
- /* Rewind file... */
+ /* Rewind file */
if (lseek(ifd, fpos, SEEK_SET) < fpos) {
perror("lseek");
exit(2);
}
- /*
- * ... and restore number of items for volatile activities
- * for this position in file.
- */
- sr_act_nr(save_act_nr, DO_RESTORE);
/* Process now RESTART entries to display restart messages */
if (*fmt[f_position]->f_restart) {
(*fmt[f_position]->f_restart)(&tab, F_END, NULL, NULL, FALSE, &file_hdr);
}
- /* Rewind file... */
+ /* Rewind file */
if (lseek(ifd, fpos, SEEK_SET) < fpos) {
perror("lseek");
exit(2);
}
- /*
- * ... and restore number of items for volatile activities
- * for this position in file.
- */
- sr_act_nr(save_act_nr, DO_RESTORE);
/* Last, process COMMENT entries to display comments */
if (DISPLAY_COMMENT(flags)) {
if (!cnt) {
/* Go to next Linux restart, if possible */
do {
- eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_VOLATILE,
+ eosaf = read_next_sample(ifd, IGNORE_RESTART | DONT_READ_CPU_NR,
curr, file, &rtype, 0, file_magic,
file_actlst, rectime, loctime);
}
long cnt = 1;
off_t fpos;
int graph_nr = 0;
- __nr_t save_act_nr[NR_ACT] = {0};
/* Use a decimal point to make SVG code locale independent */
setlocale(LC_NUMERIC, "C");
perror("lseek");
exit(2);
}
- /* Save number of activities items for current file position */
- sr_act_nr(save_act_nr, DO_SAVE);
/* For each requested activity, display graphs */
for (i = 0; i < NR_ACT; i++) {
display_curr_act_graphs(ifd, fpos, &curr, &cnt, &eosaf,
p, &reset, file_actlst,
rectime, loctime, file,
- file_magic, save_act_nr, &g_nr);
+ file_magic, &g_nr);
}
else {
unsigned int optf, msk;
display_curr_act_graphs(ifd, fpos, &curr, &cnt, &eosaf,
p, &reset, file_actlst,
rectime, loctime, file,
- file_magic, save_act_nr, &g_nr);
+ file_magic, &g_nr);
act[p]->opt_flags = optf;
}
}
#define IGNORE_NOTHING 0
#define IGNORE_RESTART 1
-#define DONT_READ_VOLATILE 2
+#define DONT_READ_CPU_NR 2
#define IGNORE_COMMENT 4
#define SET_TIMESTAMPS 8
file_hdr->sa_cpu_nr > 1 ? file_hdr->sa_cpu_nr - 1 : 1,
PLAIN_OUTPUT);
- printf(_("Number of CPU for last samples in file: %u\n"),
- file_hdr->sa_last_cpu_nr > 1 ? file_hdr->sa_last_cpu_nr - 1 : 1);
-
/* Fill file timestmap structure (rectime) */
get_file_timestamp_struct(flags, &rectime, file_hdr);
strftime(cur_time, sizeof(cur_time), "%Y-%m-%d", &rectime);
printf(_("Size of a long int: %d\n"), file_hdr->sa_sizeof_long);
printf("HZ = %lu\n", file_hdr->sa_hz);
- /* Number of activities (number of volatile activities) in file */
- printf("sa_act_nr (sa_vol_act_nr): %u (%u)\n",
- file_hdr->sa_act_nr, file_hdr->sa_vol_act_nr);
+ /* Number of activities in file */
+ printf("sa_act_nr: %u\n",
+ file_hdr->sa_act_nr);
printf(_("List of activities:\n"));