1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 19 package org.apache.giraph.metrics; 20 21 import java.util.concurrent.TimeUnit; 22 23 /** 24 * Description for Meters used in Giraph. 25 */ 26 public enum MeterDesc { 27 /** Number of requests received */ 28 RECEIVED_REQUESTS("requests-received", "requests", TimeUnit.SECONDS), 29 /** Number of requests sent */ 30 SENT_REQUESTS("requests-sent", "requests", TimeUnit.SECONDS), 31 /** Total edges loaded */ 32 EDGES_LOADED("edges-loaded", "edges", TimeUnit.SECONDS), 33 /** Total vertices loaded */ 34 VERTICES_LOADED("vertices-loaded", "vertices", TimeUnit.SECONDS); 35 36 /** Name of meter */ 37 private final String name; 38 /** Type this meter tracks */ 39 private final String type; 40 /** TimeUnit this meter tracks in */ 41 private final TimeUnit timeUnit; 42 43 /** 44 * Constructor 45 * @param name String name of meter 46 * @param type String type of meter 47 * @param timeUnit TimeUnit meter tracks 48 */ 49 private MeterDesc(String name, String type, TimeUnit timeUnit) { 50 this.name = name; 51 this.type = type; 52 this.timeUnit = timeUnit; 53 } 54 55 /** 56 * Get name of meter 57 * @return String name 58 */ 59 public String getName() { 60 return name; 61 } 62 63 /** 64 * Get TimeUnit of meter 65 * @return TimeUnit 66 */ 67 public TimeUnit getTimeUnit() { 68 return timeUnit; 69 } 70 71 /** 72 * Get type of meter 73 * @return String type 74 */ 75 public String getType() { 76 return type; 77 } 78 }