- add sources.
[platform/framework/web/crosswalk.git] / src / net / disk_cache / simple / simple_histogram_macros.h
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_HISTOGRAM_MACROS_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_HISTOGRAM_MACROS_H_
7
8 #include "base/metrics/histogram.h"
9 #include "base/metrics/sparse_histogram.h"
10 #include "net/base/cache_type.h"
11
12 // This file contains macros used to report histograms. The main issue is that
13 // we want to have separate histograms for each type of cache (http vs app),
14 // while making it easy to report histograms and have all names precomputed.
15
16 #define SIMPLE_CACHE_THUNK(uma_type, args) UMA_HISTOGRAM_##uma_type args
17
18 #define SIMPLE_CACHE_UMA(uma_type, uma_name, cache_type, ...)         \
19   do {                                                                \
20     switch (cache_type) {                                             \
21       case net::DISK_CACHE:                                           \
22         SIMPLE_CACHE_THUNK(                                           \
23             uma_type, ("SimpleCache.Http." uma_name, ##__VA_ARGS__)); \
24         break;                                                        \
25       case net::APP_CACHE:                                            \
26         SIMPLE_CACHE_THUNK(                                           \
27             uma_type, ("SimpleCache.App." uma_name, ##__VA_ARGS__));  \
28         break;                                                        \
29       default:                                                        \
30         NOTREACHED();                                                 \
31         break;                                                        \
32     }                                                                 \
33   } while (0)
34
35 #endif  // NET_DISK_CACHE_SIMPLE_SIMPLE_HISTOGRAM_MACROS_H_