1 /* 2 * Copyright (c) 2021 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef CLOCK_FILTER_EX_H 17 #define CLOCK_FILTER_EX_H 18 19 #include <map> 20 #include <memory> 21 #include <string> 22 #include <unordered_map> 23 #include <vector> 24 25 #include "clock_filter.h" 26 #include "filter_base.h" 27 #include "htrace_file_header.h" 28 #include "trace_streamer_filters.h" 29 #include "ts_common.h" 30 31 namespace SysTuning { 32 namespace TraceStreamer { 33 class TraceDataCache; 34 35 /* 36 * TS_REALTIME: A settable system-wide clock that measures real time. Its time represents seconds and nanoseconds 37 * since the Epoch. 38 * TS_REALTIME_COARSE: A faster but less precise version of TS_REALTIME. This clock is not settable. 39 * TS_MONOTONIC: The number of seconds that the system has been running since it was booted.The CLOCK_MONOTONIC 40 * clock is not affected by discontinuous jumps in the system time ,but is affected by the incremental adjustments 41 * performed by adjtime(3) and NTP. This clock does not count time that the system is suspended. 42 * TS_MONOTONIC_COARSE: A faster but less precise version of TS_MONOTONIC. 43 * TS_MONOTONIC_RAW: Similar to TS_MONOTONIC, but provides access to a raw hardware-based time that is not subject 44 * to NTP adjustments or the incremental adjustments performed by adjtime(3). This clock does not count time that the 45 * system is suspended. 46 * TS_BOOTTIME: A nonsettable system-wide clock that is identical to TS_MONOTONIC, except that it also includes 47 * any time that the system is suspended. 48 */ 49 class ClockFilterEx : public FilterBase, public ClockFilter { 50 public: 51 ClockFilterEx(TraceDataCache* dataCache, const TraceStreamerFilters* filter); 52 ~ClockFilterEx() override; 53 void AddClockSnapshot(const std::vector<SnapShot>& snapShot); 54 55 private: 56 TraceDataCache* dataCache_; 57 }; 58 } // namespace TraceStreamer 59 } // namespace SysTuning 60 61 #endif // CLOCK_FILTER_EX_H 62