blob: 0c4a57d5097b92e69f15e93eb8e32e69023270e9 [file] [log] [blame]
Kevin DuBoisa74ef6f2017-10-23 11:07:15 -07001# Copyright 2017 Google, ARM Limited
2#
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
17"""
18Definitions of filesystem (ext4) trace parsers
19registered by the FTrace class
20"""
21
22from trappy.base import Base
23from trappy.dynamic import register_ftrace_parser, register_dynamic_ftrace
24
25class FilesystemExt4Base(Base):
26 def generate_data_dict(self, data_str):
27 #filesystem traces are space delimited in the form:
28 #fieldA valueA fieldB valueB ...
29 data = data_str.split(' ')
30 return zip(data[0::2], data[1::2])
31
32 def finalize_object(self):
33 self.data_frame.rename(columns={'ino':'inode'}, inplace=True)
34
35
36class FilesystemExt4DaWriteBegin(FilesystemExt4Base):
37 """Corresponds to Linux kernel trace event ext4_da_write_begin"""
38
39 unique_word = "ext4_da_write_begin:"
40 """The unique word that will be matched in a trace line"""
41
42
43register_ftrace_parser(FilesystemExt4DaWriteBegin)
44
45class FilesystemExt4DaWriteEnd(FilesystemExt4Base):
46 """Corresponds to Linux kernel trace event ext4_da_write_end"""
47
48 unique_word = "ext4_da_write_end:"
49 """The unique word that will be matched in a trace line"""
50
51register_ftrace_parser(FilesystemExt4DaWriteEnd)
52
53class FilesystemExt4SyncFileEnter(FilesystemExt4Base):
54 """Corresponds to Linux kernel trace event ext4_sync_file_enter"""
55
56 unique_word = "ext4_sync_file_enter:"
57 """The unique word that will be matched in a trace line"""
58
59register_ftrace_parser(FilesystemExt4SyncFileEnter)
60
61class FilesystemExt4SyncFileExit(FilesystemExt4Base):
62 """Corresponds to Linux kernel trace event ext4_sync_file_exit"""
63
64 unique_word = "ext4_sync_file_exit:"
65 """The unique word that will be matched in a trace line"""
66
67register_ftrace_parser(FilesystemExt4SyncFileExit)