Motr  M0
hist__srpc_to_crpc.py
Go to the documentation of this file.
1 #
2 # Copyright (c) 2020 Seagate Technology LLC and/or its Affiliates
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15 #
16 # For any questions about this software or licensing,
17 # please email opensource@seagate.com or cortx-questions@seagate.com.
18 #
19 
20 attr={ "name": "srpc_to_crpc" }
21 
22 def query(from_, to_):
23  q=f"""
24  SELECT (crq.time-srq.time), crq.state, srq.state
25 
26  FROM rpc_to_sxid
27  JOIN sxid_to_rpc on rpc_to_sxid.xid=sxid_to_rpc.xid AND rpc_to_sxid.session_id=sxid_to_rpc.session_id
28  JOIN rpc_req crq on rpc_to_sxid.id=crq.id AND rpc_to_sxid.pid=crq.pid
29  JOIN rpc_req srq on sxid_to_rpc.id=srq.id AND sxid_to_rpc.pid=srq.pid
30 
31  WHERE sxid_to_rpc.opcode in (41,42,45,46,47) and rpc_to_sxid.opcode in (41,42,45,46,47)
32  AND rpc_to_sxid.xid > 0
33  AND rpc_to_sxid.session_id > 0
34  AND crq.state="{to_}"
35  AND srq.state="{from_}";
36  """
37  return q
38 
39 if __name__ == '__main__':
40  import sys
41  sys.exit(1)
def query(from_, to_)