- Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample_query.lua
More file actions
Latest commit
117 lines (102 loc) · 2.64 KB
/
Copy pathexample_query.lua
File metadata and controls
117 lines (102 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
functionquery1()
localr_start, r_end=en_span_range()
localids= {}
fori=r_start, r_enddo
ifen_child_cnt(i) >2then
table.insert(ids, i)
end
end
returnids
end
functionquery4()
localr_start, r_end=en_span_range()
localids= {}
fori=r_start, r_enddo
ifnoten_contains_anywhere(i, "winit") then
table.insert(ids, i)
end
end
returnids
end
functionquery5()
localr_start, r_end=en_span_range()
localids= {}
fori=r_start, r_enddo
localmsg_cnt=en_attr_by_name(i, "msg_idx")
ifmsg_cnt~=nilandmath.fmod(msg_cnt, 2) ==1then
table.insert(ids, i)
end
end
returnids
end
functionquery6()
localr_start, r_end=en_span_range()
localids= {}
fori=r_start, r_enddo
localis_winit=en_metadata_target(i) =="winit::window"
locallog_module_path=en_attr_by_name(i, "log.module_path")
localis_eframe_related=log_module_path~=nilandstring.match(log_module_path, "eframe")
ifis_winitoris_eframe_relatedthen
table.insert(ids, i)
end
end
returnids
end
functionquery7()
localr_start, r_end=en_span_range()
localids= {}
fori=r_start, r_enddo
localnode_value=en_attr_by_name(i, "node_value")
ifnode_valueandnode_value>="d3" then
table.insert(ids, i)
end
end
returnids
end
-- equivalent to query7(), but about 2x faster.
functionquery8()
localr_start, r_end=en_span_range()
filter_settings= {
target="node_value",
relation="GT",
value="d3",
}
filtered=en_filter_range(r_start, r_end, filter_settings)
returnfiltered
end
-- we are looking for the spans where
-- message = "constructed node"
-- breadth > 1
-- This is the "old fashioned" no filterset implementation
functionquery9()
localrstart, rend=en_span_range()
localids= {}
fori=rstart, renddo
localmessage_matches=en_attr_by_name(i, "message") =="constructed node"
ifmessage_matchesand (en_attr_by_name(i, "breadth") >1) then
table.insert(ids, i)
end
end
returnids
end
functionquery10()
localrstart, rend=en_span_range()
localbase=en_filterset_from_range(rstart, rend)
msg_filter_desc= { target="message", value="constructed node", relation="EQ" }
localmessage_matches=en_filter(msg_filter_desc, base)
breadth_filter_desc= { target="breadth", value=1, relation="GT" }
localbreadth_matches=en_filter(breadth_filter_desc, message_matches)
final=breadth_matches
materialized=en_filterset_materialize(final)
returnmaterialized
end
functionquery11()
localrstart, rend=en_span_range()
localids= {}
fori=rstart, renddo
table.insert(ids, i)
end
joined=en_join(ids)
table.sort(joined)
returnjoined
end