Update CountAnomalyTracker to handle slicing. Re-added CountAnomalyTracker (under the name DiscreteAnomalyDetector). It is now able to handle dimensions. Test: unit test passed. Change-Id: I133fcf6db99b9e305756f7ee5891c25f0f276348
diff --git a/bin/src/stats_util.h b/bin/src/stats_util.h index a9507bf..e1d0ace 100644 --- a/bin/src/stats_util.h +++ b/bin/src/stats_util.h
@@ -13,8 +13,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -#ifndef STATS_UTIL_H -#define STATS_UTIL_H + +#pragma once #include "logd/LogReader.h" #include "storage/DropboxWriter.h" @@ -22,6 +22,8 @@ #include <log/logprint.h> #include "frameworks/base/cmds/statsd/src/statsd_config.pb.h" +#include <unordered_map> + namespace android { namespace os { namespace statsd { @@ -33,6 +35,10 @@ typedef std::map<std::string, HashableDimensionKey> ConditionKey; +// TODO: For P, change int to int64_t. +// TODO: Should HashableDimensionKey be marked here as const? +typedef std::unordered_map<HashableDimensionKey, int> DimToValMap; + EventMetricData parse(log_msg msg); int getTagId(log_msg msg); @@ -41,5 +47,3 @@ } // namespace statsd } // namespace os } // namespace android - -#endif // STATS_UTIL_H