1 /*- 2 * See the file LICENSE for redistribution information. 3 * 4 * Copyright (c) 2002, 2014 Oracle and/or its affiliates. All rights reserved. 5 * 6 */ 7 8 package com.sleepycat.je.utilint; 9 10 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_DELETE; 11 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETCURRENT; 12 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETFIRST; 13 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETLAST; 14 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETNEXT; 15 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETNEXTDUP; 16 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETNEXTNODUP; 17 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETPREV; 18 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETPREVDUP; 19 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_GETPREVNODUP; 20 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_PUT; 21 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_PUTCURRENT; 22 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_PUTNODUPDATA; 23 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_CURSOR_PUTNOOVERWRITE; 24 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_DELETE; 25 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_GET; 26 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_GETSEARCHBOTH; 27 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_PUT; 28 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_PUTNODUPDATA; 29 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_PUTNOOVERWRITE; 30 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DB_REMOVESEQUENCE; 31 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_DOSCURSOR_GETNEXT; 32 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_DELETE; 33 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETCURRENT; 34 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETFIRST; 35 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETLAST; 36 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETNEXT; 37 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETNEXTDUP; 38 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETNEXTNODUP; 39 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETPREV; 40 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETPREVDUP; 41 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYCURSOR_GETPREVNODUP; 42 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYDB_DELETE; 43 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYDB_GET; 44 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_SECONDARYDB_GETSEARCHBOTH; 45 46 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_BIN_DELTA_GETS; 47 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_BIN_DELTA_INSERTS; 48 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_BIN_DELTA_UPDATES; 49 import static com.sleepycat.je.dbi.DbiStatDefinition.THROUGHPUT_BIN_DELTA_DELETES; 50 51 52 public class ThroughputStatGroup extends StatGroup { 53 54 private static final long serialVersionUID = 1L; 55 56 public static final int DB_DELETE_OFFSET = 0; 57 public static final int DB_GET_OFFSET = 1; 58 public static final int DB_GETSEARCHBOTH_OFFSET = 2; 59 public static final int DB_PUT_OFFSET = 3; 60 public static final int DB_PUTNODUPDATA_OFFSET = 4; 61 public static final int DB_PUTNOOVERWRITE_OFFSET = 5; 62 public static final int DB_REMOVESEQUENCE_OFFSET = 6; 63 public static final int CURSOR_DELETE_OFFSET = 7; 64 public static final int CURSOR_GETCURRENT_OFFSET = 8; 65 public static final int CURSOR_GETFIRST_OFFSET = 9; 66 public static final int CURSOR_GETLAST_OFFSET = 10; 67 public static final int CURSOR_GETNEXT_OFFSET = 11; 68 public static final int CURSOR_GETNEXTDUP_OFFSET = 12; 69 public static final int CURSOR_GETNEXTNODUP_OFFSET = 13; 70 public static final int CURSOR_GETPREV_OFFSET = 14; 71 public static final int CURSOR_GETPREVDUP_OFFSET = 15; 72 public static final int CURSOR_GETPREVNODUP_OFFSET = 16; 73 public static final int CURSOR_PUT_OFFSET = 17; 74 public static final int CURSOR_PUTCURRENT_OFFSET = 18; 75 public static final int CURSOR_PUTNODUPDATA_OFFSET = 19; 76 public static final int CURSOR_PUTNOOVERWRITE_OFFSET = 20; 77 public static final int SECONDARYCURSOR_DELETE_OFFSET = 21; 78 public static final int SECONDARYCURSOR_GETCURRENT_OFFSET = 22; 79 public static final int SECONDARYCURSOR_GETFIRST_OFFSET = 23; 80 public static final int SECONDARYCURSOR_GETLAST_OFFSET = 24; 81 public static final int SECONDARYCURSOR_GETNEXT_OFFSET = 25; 82 public static final int SECONDARYCURSOR_GETNEXTDUP_OFFSET = 26; 83 public static final int SECONDARYCURSOR_GETNEXTNODUP_OFFSET = 27; 84 public static final int SECONDARYCURSOR_GETPREV_OFFSET = 28; 85 public static final int SECONDARYCURSOR_GETPREVDUP_OFFSET = 29; 86 public static final int SECONDARYCURSOR_GETPREVNODUP_OFFSET = 30; 87 public static final int SECONDARYDB_DELETE_OFFSET = 31; 88 public static final int SECONDARYDB_GET_OFFSET = 32; 89 public static final int SECONDARYDB_GETSEARCHBOTH_OFFSET = 33; 90 public static final int DOSCURSOR_GETNEXT_OFFSET = 34; 91 92 public static final int BIN_DELTA_GETS_OFFSET = 35; 93 public static final int BIN_DELTA_INSERTS_OFFSET = 36; 94 public static final int BIN_DELTA_UPDATES_OFFSET = 37; 95 public static final int BIN_DELTA_DELETES_OFFSET = 38; 96 97 private static final int MAX_OFFSET = 39; 98 99 private final AtomicLongStat[] stats = new AtomicLongStat[MAX_OFFSET]; 100 ThroughputStatGroup(String groupName, String groupDescription)101 public ThroughputStatGroup(String groupName, String groupDescription) { 102 super(groupName, groupDescription); 103 createThroughputStats(); 104 } 105 increment(int statOffset)106 public void increment(int statOffset) { 107 stats[statOffset].increment(); 108 } 109 createThroughputStats()110 private void createThroughputStats() { 111 stats[DB_DELETE_OFFSET] = 112 new AtomicLongStat(this, THROUGHPUT_DB_DELETE); 113 stats[DB_GET_OFFSET] = 114 new AtomicLongStat(this, THROUGHPUT_DB_GET); 115 stats[DB_GETSEARCHBOTH_OFFSET] = 116 new AtomicLongStat(this, THROUGHPUT_DB_GETSEARCHBOTH); 117 stats[DB_PUT_OFFSET] = 118 new AtomicLongStat(this, THROUGHPUT_DB_PUT); 119 stats[DB_PUTNODUPDATA_OFFSET] = 120 new AtomicLongStat(this, THROUGHPUT_DB_PUTNODUPDATA); 121 stats[DB_PUTNOOVERWRITE_OFFSET] = 122 new AtomicLongStat(this, THROUGHPUT_DB_PUTNOOVERWRITE); 123 stats[DB_REMOVESEQUENCE_OFFSET] = 124 new AtomicLongStat(this, THROUGHPUT_DB_REMOVESEQUENCE); 125 stats[CURSOR_DELETE_OFFSET] = 126 new AtomicLongStat(this, THROUGHPUT_CURSOR_DELETE); 127 stats[CURSOR_GETCURRENT_OFFSET] = 128 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETCURRENT); 129 stats[CURSOR_GETFIRST_OFFSET] = 130 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETFIRST); 131 stats[CURSOR_GETLAST_OFFSET] = 132 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETLAST); 133 stats[CURSOR_GETNEXT_OFFSET] = 134 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETNEXT); 135 stats[CURSOR_GETNEXTDUP_OFFSET] = 136 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETNEXTDUP); 137 stats[CURSOR_GETNEXTNODUP_OFFSET] = 138 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETNEXTNODUP); 139 stats[CURSOR_GETPREV_OFFSET] = 140 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETPREV); 141 stats[CURSOR_GETPREVDUP_OFFSET] = 142 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETPREVDUP); 143 stats[CURSOR_GETPREVNODUP_OFFSET] = 144 new AtomicLongStat(this, THROUGHPUT_CURSOR_GETPREVNODUP); 145 stats[CURSOR_PUT_OFFSET] = 146 new AtomicLongStat(this, THROUGHPUT_CURSOR_PUT); 147 stats[CURSOR_PUTCURRENT_OFFSET] = 148 new AtomicLongStat(this, THROUGHPUT_CURSOR_PUTCURRENT); 149 stats[CURSOR_PUTNODUPDATA_OFFSET] = 150 new AtomicLongStat(this, THROUGHPUT_CURSOR_PUTNODUPDATA); 151 stats[CURSOR_PUTNOOVERWRITE_OFFSET] = 152 new AtomicLongStat(this, THROUGHPUT_CURSOR_PUTNOOVERWRITE); 153 stats[SECONDARYCURSOR_DELETE_OFFSET] = 154 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_DELETE); 155 stats[SECONDARYCURSOR_GETCURRENT_OFFSET] = 156 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETCURRENT); 157 stats[SECONDARYCURSOR_GETFIRST_OFFSET] = 158 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETFIRST); 159 stats[SECONDARYCURSOR_GETLAST_OFFSET] = 160 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETLAST); 161 stats[SECONDARYCURSOR_GETNEXT_OFFSET] = 162 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETNEXT); 163 stats[SECONDARYCURSOR_GETNEXTDUP_OFFSET] = 164 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETNEXTDUP); 165 stats[SECONDARYCURSOR_GETNEXTNODUP_OFFSET] = 166 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETNEXTNODUP); 167 stats[SECONDARYCURSOR_GETPREV_OFFSET] = 168 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETPREV); 169 stats[SECONDARYCURSOR_GETPREVDUP_OFFSET] = 170 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETPREVDUP); 171 stats[SECONDARYCURSOR_GETPREVNODUP_OFFSET] = 172 new AtomicLongStat(this, THROUGHPUT_SECONDARYCURSOR_GETPREVNODUP); 173 stats[SECONDARYDB_DELETE_OFFSET] = 174 new AtomicLongStat(this, THROUGHPUT_SECONDARYDB_DELETE); 175 stats[SECONDARYDB_GET_OFFSET] = 176 new AtomicLongStat(this, THROUGHPUT_SECONDARYDB_GET); 177 stats[SECONDARYDB_GETSEARCHBOTH_OFFSET] = 178 new AtomicLongStat(this, THROUGHPUT_SECONDARYDB_GETSEARCHBOTH); 179 stats[DOSCURSOR_GETNEXT_OFFSET] = 180 new AtomicLongStat(this, THROUGHPUT_DOSCURSOR_GETNEXT); 181 182 stats[BIN_DELTA_GETS_OFFSET] = 183 new AtomicLongStat(this, THROUGHPUT_BIN_DELTA_GETS); 184 185 stats[BIN_DELTA_INSERTS_OFFSET] = 186 new AtomicLongStat(this, THROUGHPUT_BIN_DELTA_INSERTS); 187 188 stats[BIN_DELTA_UPDATES_OFFSET] = 189 new AtomicLongStat(this, THROUGHPUT_BIN_DELTA_UPDATES); 190 191 stats[BIN_DELTA_DELETES_OFFSET] = 192 new AtomicLongStat(this, THROUGHPUT_BIN_DELTA_DELETES); 193 } 194 } 195