summaryrefslogtreecommitdiffstats
path: root/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'framework/src/onos/utils/misc/src/main/java/org/onlab/metrics')
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/EventMetric.java118
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponent.java60
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponentRegistry.java36
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsFeature.java41
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java304
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsService.java178
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsUtil.java56
-rw-r--r--framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/package-info.java20
8 files changed, 0 insertions, 813 deletions
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/EventMetric.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/EventMetric.java
deleted file mode 100644
index d20ca53f..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/EventMetric.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Meter;
-
-/**
- * Metric measurements for events.
- */
-public class EventMetric {
- private static final String GAUGE_TIMESTAMP_NAME = "Timestamp.EpochMs";
- private static final String METER_RATE_NAME = "Rate";
-
- private final MetricsService metricsService;
- private final String componentName;
- private final String featureName;
-
- private MetricsComponent metricsComponent;
- private MetricsFeature metricsFeature;
-
- private volatile long lastEventTimestampEpochMs = 0;
- private Gauge<Long> lastEventTimestampGauge;
- private Meter eventRateMeter;
-
- /**
- * Constructor.
- *
- * @param metricsService the Metrics Service to use for Metrics
- * registration and deregistration
- * @param componentName the Metrics Component Name to use for Metrics
- * registration and deregistration
- * @param featureName the Metrics Feature Name to use for Metrics
- * registration and deregistration
- */
- public EventMetric(MetricsService metricsService, String componentName,
- String featureName) {
- this.metricsService = metricsService;
- this.componentName = componentName;
- this.featureName = featureName;
- }
-
- /**
- * Registers the metrics.
- */
- public void registerMetrics() {
- metricsComponent = metricsService.registerComponent(componentName);
- metricsFeature = metricsComponent.registerFeature(featureName);
-
- lastEventTimestampEpochMs = 0;
- lastEventTimestampGauge =
- metricsService.registerMetric(metricsComponent,
- metricsFeature,
- GAUGE_TIMESTAMP_NAME,
- new Gauge<Long>() {
- @Override
- public Long getValue() {
- return lastEventTimestampEpochMs;
- }
- });
-
- eventRateMeter = metricsService.createMeter(metricsComponent,
- metricsFeature,
- METER_RATE_NAME);
- }
-
- /**
- * Removes the metrics.
- */
- public void removeMetrics() {
- lastEventTimestampEpochMs = 0;
- metricsService.removeMetric(metricsComponent,
- metricsFeature,
- GAUGE_TIMESTAMP_NAME);
- metricsService.removeMetric(metricsComponent,
- metricsFeature,
- METER_RATE_NAME);
- }
-
- /**
- * Updates the metric measurements for a single event.
- */
- public void eventReceived() {
- lastEventTimestampEpochMs = System.currentTimeMillis();
- eventRateMeter.mark(1);
- }
-
- /**
- * Gets the last event timestamp Gauge (ms from the Epoch).
- *
- * @return the last event timestamp Gauge (ms from the Epoch)
- */
- public Gauge<Long> lastEventTimestampGauge() {
- return lastEventTimestampGauge;
- }
-
- /**
- * Gets the event rate meter.
- *
- * @return the event rate meter
- */
- public Meter eventRateMeter() {
- return eventRateMeter;
- }
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponent.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponent.java
deleted file mode 100644
index cc8fe83c..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponent.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-/**
- * Components to register for metrics.
- */
-public class MetricsComponent implements MetricsComponentRegistry {
- private final String name;
-
- /**
- * Registry to hold the Features defined in this Component.
- */
- private final ConcurrentMap<String, MetricsFeature> featuresRegistry =
- new ConcurrentHashMap<>();
-
- /**
- * Constructs a component from a name.
- *
- * @param newName name of the component
- */
- MetricsComponent(final String newName) {
- name = newName;
- }
-
- @Override
- public String getName() {
- return name;
- }
-
- @Override
- public MetricsFeature registerFeature(final String featureName) {
- MetricsFeature feature = featuresRegistry.get(featureName);
- if (feature == null) {
- final MetricsFeature createdFeature =
- new MetricsFeature(featureName);
- feature = featuresRegistry.putIfAbsent(featureName, createdFeature);
- if (feature == null) {
- feature = createdFeature;
- }
- }
- return feature;
- }
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponentRegistry.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponentRegistry.java
deleted file mode 100644
index 89f6ec5e..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsComponentRegistry.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-/**
- * Registry Entry for Metrics Components.
- */
-public interface MetricsComponentRegistry {
- /**
- * Fetches the name of the Component.
- *
- * @return name of the Component
- */
- String getName();
-
- /**
- * Registers a Feature for this component.
- *
- * @param featureName name of the Feature to register
- * @return Feature object that can be used when creating Metrics
- */
- MetricsFeature registerFeature(String featureName);
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsFeature.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsFeature.java
deleted file mode 100644
index bc6753c9..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsFeature.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-/**
- * Features to tag metrics.
- */
-public class MetricsFeature {
- private final String name;
-
- /**
- * Constructs a Feature from a name.
- *
- * @param newName name of the Feature
- */
- public MetricsFeature(final String newName) {
- name = newName;
- }
-
- /**
- * Fetches the name of the Feature.
- *
- * @return name of the Feature
- */
- public String getName() {
- return name;
- }
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
deleted file mode 100644
index 6c9314ad..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsManager.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Histogram;
-import com.codahale.metrics.Meter;
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricFilter;
-import com.codahale.metrics.MetricRegistry;
-import com.codahale.metrics.Timer;
-
-/**
- * This class holds the Metrics registry for ONOS.
- * All metrics (Counter, Histogram, Timer, Meter, Gauge) use a hierarchical
- * string-based naming scheme: COMPONENT.FEATURE.NAME.
- * Example: "Topology.Counters.TopologyUpdates".
- * The COMPONENT and FEATURE names have to be registered in advance before
- * a metric can be created. Example:
- * <pre>
- * <code>
- * private final MetricsManager.MetricsComponent COMPONENT =
- * MetricsManager.registerComponent("Topology");
- * private final MetricsManager.MetricsFeature FEATURE =
- * COMPONENT.registerFeature("Counters");
- * private final Counter counterTopologyUpdates =
- * MetricsManager.createCounter(COMPONENT, FEATURE, "TopologyUpdates");
- * </code>
- * </pre>
- * Gauges are slightly different because they are not created directly in
- * this class, but are allocated by the caller and passed in for registration:
- * <pre>
- * <code>
- * private final Gauge&lt;Long&gt; gauge =
- * new {@literal Gauge&lt;Long&gt}() {
- * {@literal @}Override
- * public Long getValue() {
- * return gaugeValue;
- * }
- * };
- * MetricsManager.registerMetric(COMPONENT, FEATURE, GAUGE_NAME, gauge);
- * </code>
- * </pre>
- */
-public class MetricsManager implements MetricsService {
-
- /**
- * Registry to hold the Components defined in the system.
- */
- private ConcurrentMap<String, MetricsComponent> componentsRegistry =
- new ConcurrentHashMap<>();
-
- /**
- * Registry for the Metrics objects created in the system.
- */
- private MetricRegistry metricsRegistry = new MetricRegistry();
-
- /**
- * Clears the internal state.
- */
- protected void clear() {
- this.componentsRegistry = new ConcurrentHashMap<>();
- this.metricsRegistry = new MetricRegistry();
- }
-
- /**
- * Registers a component.
- *
- * @param name name of the Component to register
- * @return MetricsComponent object that can be used to create Metrics.
- */
- @Override
- public MetricsComponent registerComponent(final String name) {
- MetricsComponent component = componentsRegistry.get(name);
- if (component == null) {
- final MetricsComponent createdComponent =
- new MetricsComponent(name);
- component = componentsRegistry.putIfAbsent(name, createdComponent);
- if (component == null) {
- component = createdComponent;
- }
- }
- return component;
- }
-
- /**
- * Generates a name for a Metric from its component and feature.
- *
- * @param component component the metric is defined in
- * @param feature feature the metric is defined in
- * @param metricName local name of the metric
- *
- * @return full name of the metric
- */
- private String generateName(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- return MetricRegistry.name(component.getName(),
- feature.getName(),
- metricName);
- }
-
- /**
- * Creates a Counter metric.
- *
- * @param component component the Counter is defined in
- * @param feature feature the Counter is defined in
- * @param metricName local name of the metric
- * @return the created Counter Meteric
- */
- @Override
- public Counter createCounter(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- final String name = generateName(component, feature, metricName);
- return metricsRegistry.counter(name);
- }
-
- /**
- * Creates a Histogram metric.
- *
- * @param component component the Histogram is defined in
- * @param feature feature the Histogram is defined in
- * @param metricName local name of the metric
- * @return the created Histogram Metric
- */
- @Override
- public Histogram createHistogram(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- final String name = generateName(component, feature, metricName);
- return metricsRegistry.histogram(name);
- }
-
- /**
- * Creates a Timer metric.
- *
- * @param component component the Timer is defined in
- * @param feature feature the Timer is defined in
- * @param metricName local name of the metric
- * @return the created Timer Metric
- */
- @Override
- public Timer createTimer(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- final String name = generateName(component, feature, metricName);
- return metricsRegistry.timer(name);
- }
-
- /**
- * Creates a Meter metric.
- *
- * @param component component the Meter is defined in
- * @param feature feature the Meter is defined in
- * @param metricName local name of the metric
- * @return the created Meter Metric
- */
- @Override
- public Meter createMeter(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- final String name = generateName(component, feature, metricName);
- return metricsRegistry.meter(name);
- }
-
- /**
- * Registers an already created Metric. This is used for situation where a
- * caller needs to allocate its own Metric, but still register it with the
- * system.
- *
- * @param <T> Metric type
- * @param component component the Metric is defined in
- * @param feature feature the Metric is defined in
- * @param metricName local name of the metric
- * @param metric Metric to register
- * @return the registered Metric
- */
- @Override
- public <T extends Metric> T registerMetric(
- final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName,
- final T metric) {
- final String name = generateName(component, feature, metricName);
- metricsRegistry.register(name, metric);
- return metric;
- }
-
- /**
- * Removes the metric with the given name.
- *
- * @param component component the Metric is defined in
- * @param feature feature the Metric is defined in
- * @param metricName local name of the metric
- * @return true if the metric existed and was removed, otherwise false
- */
- @Override
- public boolean removeMetric(final MetricsComponent component,
- final MetricsFeature feature,
- final String metricName) {
- final String name = generateName(component, feature, metricName);
- return metricsRegistry.remove(name);
- }
-
- /**
- * Fetches the existing Timers.
- *
- * @param filter filter to use to select Timers
- * @return a map of the Timers that match the filter, with the key as the
- * name String to the Timer.
- */
- @Override
- public Map<String, Timer> getTimers(final MetricFilter filter) {
- return metricsRegistry.getTimers(filter);
- }
-
- /**
- * Fetches the existing Gauges.
- *
- * @param filter filter to use to select Gauges
- * @return a map of the Gauges that match the filter, with the key as the
- * name String to the Gauge.
- */
- @Override
- public Map<String, Gauge> getGauges(final MetricFilter filter) {
- return metricsRegistry.getGauges(filter);
- }
-
- /**
- * Fetches the existing Counters.
- *
- * @param filter filter to use to select Counters
- * @return a map of the Counters that match the filter, with the key as the
- * name String to the Counter.
- */
- @Override
- public Map<String, Counter> getCounters(final MetricFilter filter) {
- return metricsRegistry.getCounters(filter);
- }
-
- /**
- * Fetches the existing Meters.
- *
- * @param filter filter to use to select Meters
- * @return a map of the Meters that match the filter, with the key as the
- * name String to the Meter.
- */
- @Override
- public Map<String, Meter> getMeters(final MetricFilter filter) {
- return metricsRegistry.getMeters(filter);
- }
-
- /**
- * Fetches the existing Histograms.
- *
- * @param filter filter to use to select Histograms
- * @return a map of the Histograms that match the filter, with the key as
- * the name String to the Histogram.
- */
- @Override
- public Map<String, Histogram> getHistograms(final MetricFilter filter) {
- return metricsRegistry.getHistograms(filter);
- }
-
- /**
- * Removes all Metrics that match a given filter.
- *
- * @param filter filter to use to select the Metrics to remove.
- */
- @Override
- public void removeMatching(final MetricFilter filter) {
- metricsRegistry.removeMatching(filter);
- }
-
- /**
- * Fetches the existing Meters.
- *
- *
- * @return a map of all metrics with the key as the
- * name String to the Meter.
- */
- public Map<String, Metric> getMetrics() {
- return metricsRegistry.getMetrics();
- }
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsService.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsService.java
deleted file mode 100644
index 4f0d67a8..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsService.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.onlab.metrics;
-
-import java.util.Map;
-
-import com.codahale.metrics.Counter;
-import com.codahale.metrics.Gauge;
-import com.codahale.metrics.Histogram;
-import com.codahale.metrics.Meter;
-import com.codahale.metrics.Metric;
-import com.codahale.metrics.MetricFilter;
-import com.codahale.metrics.Timer;
-
-/**
- * Metrics Service to collect metrics.
- */
-public interface MetricsService {
-
- /**
- * Registers a component.
- *
- * @param name name of the Component to register
- * @return MetricsComponent object that can be used to create Metrics.
- */
- MetricsComponent registerComponent(String name);
-
- /**
- * Creates a Counter metric.
- *
- * @param component component the Counter is defined in
- * @param feature feature the Counter is defined in
- * @param metricName local name of the metric
- * @return the created Counter Meteric
- */
- Counter createCounter(MetricsComponent component,
- MetricsFeature feature,
- String metricName);
-
- /**
- * Creates a Histogram metric.
- *
- * @param component component the Histogram is defined in
- * @param feature feature the Histogram is defined in
- * @param metricName local name of the metric
- * @return the created Histogram Metric
- */
- Histogram createHistogram(MetricsComponent component,
- MetricsFeature feature,
- String metricName);
-
- /**
- * Creates a Timer metric.
- *
- * @param component component the Timer is defined in
- * @param feature feature the Timer is defined in
- * @param metricName local name of the metric
- * @return the created Timer Metric
- */
- Timer createTimer(MetricsComponent component,
- MetricsFeature feature,
- String metricName);
-
- /**
- * Creates a Meter metric.
- *
- * @param component component the Meter is defined in
- * @param feature feature the Meter is defined in
- * @param metricName local name of the metric
- * @return the created Meter Metric
- */
- Meter createMeter(MetricsComponent component,
- MetricsFeature feature,
- String metricName);
-
- /**
- * Registers an already created Metric. This is used for situation where a
- * caller needs to allocate its own Metric, but still register it with the
- * system.
- *
- * @param <T> Metric type
- * @param component component the Metric is defined in
- * @param feature feature the Metric is defined in
- * @param metricName local name of the metric
- * @param metric Metric to register
- * @return the registered Metric
- */
- <T extends Metric> T registerMetric(
- MetricsComponent component,
- MetricsFeature feature,
- String metricName,
- T metric);
-
- /**
- * Removes the metric with the given name.
- *
- * @param component component the Metric is defined in
- * @param feature feature the Metric is defined in
- * @param metricName local name of the metric
- * @return true if the metric existed and was removed, otherwise false
- */
- boolean removeMetric(MetricsComponent component,
- MetricsFeature feature,
- String metricName);
-
- /**
- * Fetches the existing Timers.
- *
- * @param filter filter to use to select Timers
- * @return a map of the Timers that match the filter, with the key as the
- * name String to the Timer.
- */
- Map<String, Timer> getTimers(MetricFilter filter);
-
- /**
- * Fetches the existing Gauges.
- *
- * @param filter filter to use to select Gauges
- * @return a map of the Gauges that match the filter, with the key as the
- * name String to the Gauge.
- */
- Map<String, Gauge> getGauges(MetricFilter filter);
-
- /**
- * Fetches the existing Counters.
- *
- * @param filter filter to use to select Counters
- * @return a map of the Counters that match the filter, with the key as the
- * name String to the Counter.
- */
- Map<String, Counter> getCounters(MetricFilter filter);
-
- /**
- * Fetches the existing Meters.
- *
- * @param filter filter to use to select Meters
- * @return a map of the Meters that match the filter, with the key as the
- * name String to the Meter.
- */
- Map<String, Meter> getMeters(MetricFilter filter);
-
- /**
- * Fetches the existing Histograms.
- *
- * @param filter filter to use to select Histograms
- * @return a map of the Histograms that match the filter, with the key as
- * the name String to the Histogram.
- */
- Map<String, Histogram> getHistograms(MetricFilter filter);
-
- /**
- * Fetches the existing metrics.
- *
- * @return a map of the Metrics, with the key as
- * the name String to the Histogram.
- */
- Map<String, Metric> getMetrics();
-
- /**
- * Removes all Metrics that match a given filter.
- *
- * @param filter filter to use to select the Metrics to remove.
- */
- void removeMatching(MetricFilter filter);
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsUtil.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsUtil.java
deleted file mode 100644
index cab6c0ea..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/MetricsUtil.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.onlab.metrics;
-
-import com.codahale.metrics.Timer;
-import com.codahale.metrics.Timer.Context;
-
-public final class MetricsUtil {
-
- /**
- * Starts the Metric Timer.
- * <p>
- * If the given timer was null, it will silently return null.
- * </p>
- *
- * @param timer timer to start
- * @return timing context, if timer was not null
- */
- public static Context startTimer(Timer timer) {
- if (timer != null) {
- return timer.time();
- }
- return null;
- }
-
- /**
- * Stops the Metric Timer context.
- * <p>
- * If the given context was null, it will silently be ignored.
- * </p>
- *
- * @param context timing context to stop, if not null.
- */
- public static void stopTimer(Context context) {
- if (context != null) {
- context.stop();
- }
- }
-
- // avoid instantiation
- private MetricsUtil() {}
-}
diff --git a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/package-info.java b/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/package-info.java
deleted file mode 100644
index 0a61f353..00000000
--- a/framework/src/onos/utils/misc/src/main/java/org/onlab/metrics/package-info.java
+++ /dev/null
@@ -1,20 +0,0 @@
-/*
- * Copyright 2014 Open Networking Laboratory
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * Misc utils for various performance metrics.
- */
-package org.onlab.metrics;