summaryrefslogtreecommitdiff
path: root/src/pmdas/gfs2/worst_glock.h
blob: 6d1108cd27670c43fd49653cc7d25faadac71c77 (plain)
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
85
86
87
88
89
90
91
/*
 * GFS2 gfs2_glock_lock_time trace-point metrics.
 *
 * Copyright (c) 2013 - 2014 Red Hat.
 * 
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the
 * Free Software Foundation; either version 2 of the License, or (at your
 * option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 * for more details.
 */

#ifndef LOCK_TIME_H
#define LOCK_TIME_H

#define COUNT_THRESHOLD 350
#define DEFAULT_WORST_GLOCK_STATE 1
#define WORST_GLOCK_TOP 10
#define WORST_GLOCK_COUNT (NUM_GLOCKSTATS*NUM_TOPNUM)

enum {
    WORSTGLOCK_LOCK_TYPE = 0,
    WORSTGLOCK_NUMBER,
    WORSTGLOCK_SRTT,
    WORSTGLOCK_SRTTVAR,
    WORSTGLOCK_SRTTB,
    WORSTGLOCK_SRTTVARB,
    WORSTGLOCK_SIRT,
    WORSTGLOCK_SIRTVAR,
    WORSTGLOCK_DLM,
    WORSTGLOCK_QUEUE,
    NUM_GLOCKSTATS
};

enum {
    WORSTGLOCK_TRANS = 1,
    WORSTGLOCK_INODE = 2,
    WORSTGLOCK_RGRP = 3,
    WORSTGLOCK_META = 4,
    WORSTGLOCK_IOPEN = 5,
    WORSTGLOCK_FLOCK = 6,
    WORSTGLOCK_RESERVED = 7,
    WORSTGLOCK_QUOTA = 8,
    WORSTGLOCK_JOURNAL = 9
};

enum {
    TOPNUM_FIRST = 0,
    TOPNUM_SECOND,
    TOPNUM_THIRD,
    TOPNUM_FOURTH,
    TOPNUM_FIFTH,
    TOPNUM_SIXTH,
    TOPNUM_SEVENTH,
    TOPNUM_EIGHTH,
    TOPNUM_NINTH,
    TOPNUM_TENTH,
    NUM_TOPNUM
};

struct glock {
    dev_t dev_id; 
    uint32_t lock_type;    /* Glock type number */
    uint64_t number;       /* Inode or resource group number */
    int64_t srtt;          /* Non blocking smoothed round trip time */
    int64_t srttvar;       /* Non blocking smoothed variance */
    int64_t srttb;         /* Blocking smoothed round trip time */
    int64_t srttvarb;      /* Blocking smoothed variance */
    int64_t sirt;          /* Smoothed Inter-request time */
    int64_t sirtvar;       /* Smoothed Inter-request variance */
    int64_t dlm;           /* Count of dlm requests */
    int64_t queue;         /* Count of gfs2_holder queues */
};

struct worst_glock {
    struct glock glocks[WORST_GLOCK_TOP + 1];
    int    assigned_entries;
};

extern void gfs2_worst_glock_init(pmdaMetric *, int);
extern int gfs2_worst_glock_fetch(int, struct worst_glock *, pmAtomValue *);
extern int gfs2_extract_worst_glock(char **, pmInDom);

extern int worst_glock_get_state();
extern int worst_glock_set_state(pmValueSet *vsp);

#endif /* LOCK_TIME_H */