* Copyright (c) 2020 Huawei Technologies Co.,Ltd.
*
* openGauss is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
* See the Mulan PSL v2 for more details.
* ---------------------------------------------------------------------------------------
*
* redo_statistic.h
*
*
*
* IDENTIFICATION
* src/include/access/redo_statistic.h
*
* ---------------------------------------------------------------------------------------
*/
#ifndef REDO_STATISTIC_H
#define REDO_STATISTIC_H
#include "gs_thread.h"
#include "knl/knl_instance.h"
#include "pgstat.h"
#include "access/redo_statistic_msg.h"
typedef Datum (*GetViewDataFunc)();
typedef struct RedoStatsViewObj {
char name[VIEW_NAME_SIZE];
Oid data_type;
GetViewDataFunc get_data;
} RedoStatsViewObj;
typedef enum RedoWorkerWaitSyncStats {
WAIT_SYNC_AP_REF = 0,
WAIT_SYNC_AP_REP,
WAIT_SYNC_AMPSH,
WAIT_SYNC_AMPSY,
WAIT_SYNC_ARAS,
WAIT_SYNC_ARTS,
WAIT_SYNC_GXR,
WAIT_SYNC_NUM
} RedoWorkerWaitSyncStats;
typedef struct RedoWorkerStatsData {
uint32 id;
uint32 queue_usage;
uint32 queue_max_usage;
uint64 redo_rec_count;
} RedoWorkerStatsData;
extern const RedoStatsViewObj g_redoViewArr[REDO_VIEW_COL_SIZE];
extern void redo_fill_redo_event();
extern void redo_refresh_stats(uint64 speed);
extern void redo_unlink_stats_file();
static const uint64 US_TRANSFER_TO_S = (1000000);
static const uint64 BYTES_TRANSFER_KBYTES = (1024);
static const uint64 MAX_OUT_INTERVAL = (30 * 1000000);
WaitEventIO redo_get_event_type_by_wait_type(uint32 type);
char* redo_get_name_by_wait_type(uint32 type);
#endif