File: gvstats_rec.c

package info (click to toggle)
fis-gtm 6.3-014-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 36,680 kB
  • sloc: ansic: 333,039; asm: 5,180; csh: 4,956; sh: 1,924; awk: 291; makefile: 66; sed: 13
file content (84 lines) | stat: -rw-r--r-- 3,695 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/****************************************************************
 *								*
 * Copyright (c) 2008-2020 Fidelity National Information	*
 * Services, Inc. and/or its subsidiaries. All rights reserved.	*
 *								*
 *	This source code contains the intellectual property	*
 *	of its copyright holder(s), and is made available	*
 *	under a license.  If you do not know the terms of	*
 *	the license, please stop and do not read further.	*
 *								*
 ****************************************************************/

#include "mdef.h"

#include "gtm_string.h"

#include "gdsroot.h"
#include "gtm_facility.h"
#include "fileinfo.h"
#include "gdsbt.h"
#include "gdsfhead.h"
#include "gvstats_rec.h"

/* Copy header stats to shared or private */
void	gvstats_rec_csd2cnl(sgmnt_addrs *csa)
{
	memcpy(&csa->nl->gvstats_rec, &csa->hdr->gvstats_rec, SIZEOF(gvstats_rec_csd_t));
}

/* Copy shared or private back to header stats.  Note that we do not copy ("save") the WS stats */
void	gvstats_rec_cnl2csd(sgmnt_addrs *csa)
{
	size_t ws_stats_size;

	ws_stats_size = ((char *) &(csa->nl->gvstats_rec.WS_STATS_END) - (char *) &(csa->nl->gvstats_rec.WS_STATS_BEGIN))
		+ SIZEOF(gtm_uint64_t);

	/* This assumes no savable stats after the WS_* stats.  Address that here if this changes */
	memcpy(&csa->hdr->gvstats_rec, &csa->nl->gvstats_rec, SIZEOF(gvstats_rec_csd_t) - ws_stats_size);
}

void	gvstats_rec_upgrade(sgmnt_addrs *csa)
{
	node_local_ptr_t	cnl;
	sgmnt_data_ptr_t	csd;
	int			index;

	csd = csa->hdr;
	cnl = csa->nl;
	/* csd still contains gvstats info in old place. Copy over to new location */
	cnl->gvstats_rec.n_nontp_retries_0 = csd->filler_n_retries[0];
	cnl->gvstats_rec.n_nontp_retries_1 = csd->filler_n_retries[1];
	cnl->gvstats_rec.n_nontp_retries_2 = csd->filler_n_retries[2];
	cnl->gvstats_rec.n_nontp_retries_3 = csd->filler_n_retries[3];
	cnl->gvstats_rec.n_set             = csd->filler_n_puts;
	cnl->gvstats_rec.n_kill            = csd->filler_n_kills;
	cnl->gvstats_rec.n_query           = csd->filler_n_queries;
	cnl->gvstats_rec.n_get             = csd->filler_n_gets;
	cnl->gvstats_rec.n_order           = csd->filler_n_order;
	cnl->gvstats_rec.n_zprev           = csd->filler_n_zprevs;
	cnl->gvstats_rec.n_data            = csd->filler_n_data;
	/* No longer maintained            : csd->filler_n_puts_duplicate       */
	cnl->gvstats_rec.n_tp_readwrite    = csd->filler_n_tp_updates;
	/* No longer maintained            : csd->filler_n_tp_updates_duplicate */
	cnl->gvstats_rec.n_tp_tot_retries_0 = csd->filler_n_tp_retries[0];
	cnl->gvstats_rec.n_tp_tot_retries_1 = csd->filler_n_tp_retries[1];
	cnl->gvstats_rec.n_tp_tot_retries_2 = csd->filler_n_tp_retries[2];
	cnl->gvstats_rec.n_tp_tot_retries_3 = csd->filler_n_tp_retries[3];
	cnl->gvstats_rec.n_tp_tot_retries_4 = csd->filler_n_tp_retries[4];
	for (index = 5; index < 12; index++)
		cnl->gvstats_rec.n_tp_tot_retries_4 += csd->filler_n_tp_retries[index];
	cnl->gvstats_rec.n_tp_cnflct_retries_0 = csd->filler_n_tp_retries_conflicts[0];
	cnl->gvstats_rec.n_tp_cnflct_retries_1 = csd->filler_n_tp_retries_conflicts[1];
	cnl->gvstats_rec.n_tp_cnflct_retries_2 = csd->filler_n_tp_retries_conflicts[2];
	cnl->gvstats_rec.n_tp_cnflct_retries_3 = csd->filler_n_tp_retries_conflicts[3];
	cnl->gvstats_rec.n_tp_cnflct_retries_4 = csd->filler_n_tp_retries_conflicts[4];
	for (index = 5; index < 12; index++)
		cnl->gvstats_rec.n_tp_cnflct_retries_4 += csd->filler_n_tp_retries_conflicts[index];
	/* Nullify statistics that were formerly in use but no longer so */
	csd->unused_dsk_reads.curr_count = 0;
	csd->unused_dsk_reads.cumul_count = 0;
	csd->unused_dsk_writes.curr_count = 0;
	csd->unused_dsk_writes.cumul_count = 0;
}