Motr  M0
filter.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 #
3 # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 # http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 #
17 # For any questions about this software or licensing,
18 # please email opensource@seagate.com or cortx-questions@seagate.com.
19 #
20 
21 
22 import fileinput
23 import record
24 import getopt
25 import sys
26 
27 def filter(argv):
28  tr = record.trace(height = 10, width = 1000, loc_nr = 1, duration = 1,
29  step = 1)
30  rec = ""
31  fname = ""
32  f = None
33  for line in fileinput.input([]):
34  params = line[1:].split()
35  if line[0] == "*":
36  if rec != "":
37  name = "out." + node + "." + pid + "." + time
38  if name != fname:
39  if f != None:
40  f.close()
41  f = open(name, "w+")
42  fname = name
43  f.write(rec)
44  rec = ""
45  time = params[0][0:19]
46  keep = record.keep(params[1])
47  elif params[0] == "node":
48  node = params[1]
49  elif params[0] == "pid":
50  pid = params[1]
51  if keep:
52  rec += line
53  f.close()
54 
55 if __name__ == "__main__":
56  filter(sys.argv)
57 
58 
static void split(m0_bindex_t offset, int nr, bool commit)
Definition: extmap.c:230
Definition: filter.py:1
def filter(argv)
Definition: filter.py:27