track total size of static array and Unit/Class/Func
[hiphop-php.git] / hphp / runtime / base / perf-warning.h
blob73a5df0300fea1511b208978ec636db5623a06a8
1 /*
2 +----------------------------------------------------------------------+
3 | HipHop for PHP |
4 +----------------------------------------------------------------------+
5 | Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
6 +----------------------------------------------------------------------+
7 | This source file is subject to version 3.01 of the PHP license, |
8 | that is bundled with this package in the file LICENSE, and is |
9 | available through the world-wide-web at the following url: |
10 | http://www.php.net/license/3_01.txt |
11 | If you did not receive a copy of the PHP license and are unable to |
12 | obtain it through the world-wide-web, please send a note to |
13 | license@php.net so we can mail you a copy immediately. |
14 +----------------------------------------------------------------------+
16 #ifndef incl_HPHP_RUNTIME_BASE_PERF_WARNING_H_
17 #define incl_HPHP_RUNTIME_BASE_PERF_WARNING_H_
19 #include "hphp/util/struct-log.h"
21 #include <folly/Range.h>
23 #include <atomic>
25 namespace HPHP {
27 constexpr int64_t kDefaultPerfWarningRate = 100;
30 * Attempt to log an entry to the perf warning service.
32 * If StructuredLog::enabled() returns false or this event is discarded by the
33 * effective sample rate, nothing will be logged. If both of those checks pass,
34 * fillCols will be passed a StructuredLogEntry& to populate, which will then
35 * be logged. The column names "event_name" and "priority" are reserved and
36 * will be overwritten is fillCols() sets them.
38 * The effective sample rate is determined by Eval.PerfWarningSampleRate * rate
39 * (or kDefaultPerfWarningRate for the overloads that don't take a rate). If
40 * the effective sample rate is 0, all events will be discarded.
42 template<typename F>
43 void logPerfWarning(folly::StringPiece event, F fillCols);
44 template<typename F>
45 void logPerfWarning(folly::StringPiece event, int64_t rate, F fillCols);
47 template<typename F>
48 void logLowPriPerfWarning(folly::StringPiece event, F fillCols);
49 template<typename F>
50 void logLowPriPerfWarning(folly::StringPiece event, int64_t rate, F fillCols);
53 * If the given AtomicHashMap has more than one submap allocated, log a perf
54 * warning with its name.
56 * A single unique done flag should exist for each map being checked, to avoid
57 * logging more than once (process, map) pair.
59 template<typename AHM>
60 void checkAHMSubMaps(const AHM& map, folly::StringPiece mapName,
61 std::atomic<bool>& done);
63 void logAHMSubMapWarning(folly::StringPiece mapName);
67 #include "hphp/runtime/base/perf-warning-inl.h"
69 #endif