-
Notifications
You must be signed in to change notification settings - Fork 0
/
dgim
188 lines (179 loc) · 6.6 KB
/
dgim
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
%!tikz editor 1.0
\documentclass{article}
\usepackage{tikz}
\usepackage[graphics, active, tightpage]{preview}
\PreviewEnvironment{tikzpicture}
%!tikz preamble begin
%!tikz preamble end
\begin{document}
%!tikz source begin
\begin{tikzpicture}
[font=\sffamily\tiny]
\usetikzlibrary{matrix,shapes,arrows,fit}
\usetikzlibrary{matrix,positioning,fit,calc}
\pgfarrowsdeclare{arcs}{arcs}{...}
{
\pgfsetdash{}{0pt} % do not dash
\pgfsetroundjoin % fix join
\pgfsetroundcap % fix cap
\pgfpathmoveto{\pgfpoint{-10pt}{10pt}}
\pgfpatharc{180}{270}{10pt}
\pgfpatharc{90}{180}{10pt}
\pgfusepathqstroke
}
\draw[-arcs,line width=1pt] (-1.4,5.9) -- (-1.4,5.7);
\draw [line width=3pt, line cap=round, dash pattern=on 0pt off 2\pgflinewidth] (-2,6) -- (2.7,6);
\node[draw] at (-0.2,6.3) {Window Size = 40};
\draw [-to,shorten >=-1pt,gray,ultra thick] (4,-1) -- (3.5,-1.7);
\node[font=\fontsize{5}{5}\selectfont,anchor=north,text width=6cm] (note1) at (2,5.6) {
Items enter the stream here
.};
\node[font=\fontsize{5}{5}\selectfont,anchor=north,text width=6cm] (note1) at (7,0) {
The difference between the latest\\
timestamp(105) and the oldest(65)\\
equals the windows size(40). So\\
the oldest bucket is dropped
.};
\node[font=\fontsize{5}{5}\selectfont,anchor=north,text width=6cm] (note1) at (7,3) {
Combine any two adjacent buckets of\\
the same size, replace them by one\\
bucket of twice the size. The timestamp\\
of the new bucket is the\\ timestamp of the rightmost (later in time)\\
of the two buckets.
.};
\matrix [matrix of nodes] (m)
{
End Time &100 & 98 & 95 & 92 &87 & 80 & 65\\
Size & 1 & 1 & 2 & 2 & 4 & 8 & 8\\
End Time &101 & 100 & 98 &95 & 92 &87 & 80 & 65\\
Size & 1 & 1 & 1 & 2 & 2 & 4 & 8 & 8\\
End Time &101 &100 & 95 & 92 & 87 & 80 &65\\
Size & 1 & 2 & 2 & 2 & 4 & 8 & 8\\
End Time & 101 &100 &95 &87 & 80 &65\\
Size & 1 & 2 & 4 & 4 & 8 & 8\\
End Time & 102 & 101 &100 & 95 &87 & 80 & 65\\
Size & 1 & 1 & 2 & 4 & 4 & 8 & 8\\
End Time & 103 & 102 &101 &100 & 95 & 87 & 80 &65\\
Size & 1 & 1 & 1 & 2 & 4 & 4 & 8 & 8\\
End Time & 103 &102 & 100 & 95 & 87 & 80 & 65\\
Size & 1 & 2 & 2 & 4 & 4 & 8 & 8\\
End Time & 104 &103 & 102 &100 & 95 &87 &80 &65\\
Size & 1 & 1 & 2 & 2 & 4 & 4 & 8 & 8\\
End Time & 105 &104 &103 &102 &100 & 95 & 87 & 80 & 65\\
Size & 1 & 1 & 1 & 2 & 2 & 4 & 4 & 8 & 8\\
End Time & 105 &104 &102 &100 & 95 & 87 &80\\
Size & 1 & 2 & 2 & 2 & 4 & 4 & 8 \\
End Time & 105 &104 &102 & 95 &87 & 80\\
Size & 1 & 2 & 4 & 4 & 4 & 8 \\
End Time & 105 & 104 &102 & 95 & 80\\
Size & 1 & 2 & 4 & 8 & 8 \\
\\};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-1-2) (m-2-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-3-2) (m-4-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-5-2) (m-6-2)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-5-4) (m-6-4)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-6-4) (m-6-5)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-11-3) (m-12-3)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-12-3) (m-12-4)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-17-3) (m-18-3)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-18-3) (m-18-4)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-19-4) (m-20-4)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-20-4) (m-20-5)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-21-4) (m-22-4)
]{};
\node[draw=violet!99,font=\sffamily\footnotesize,inner sep=0pt,thick,rounded corners,
fit=(m-22-4) (m-22-5)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-7-2) (m-8-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-9-2) (m-10-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-11-2) (m-12-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-13-2) (m-14-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-15-2) (m-16-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-17-2) (m-18-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-19-2) (m-20-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-21-2) (m-22-2)
]{};
\node[draw=cyan,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-23-2) (m-24-2)
]{};
\node[draw=blue,font=\sffamily\footnotesize,inner sep=0pt,ultra thick,dashed,rounded corners,
fit=(m-17-10) (m-18-10)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-1-3) (m-2-8)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-3-3) (m-4-9)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-5-3) (m-6-8)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-7-3) (m-8-7)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-9-3) (m-10-8)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-11-3) (m-12-9)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-13-3) (m-14-8)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-15-3) (m-16-9)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-17-3) (m-18-9)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-19-3) (m-20-8)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-21-3) (m-22-7)
]{};
\node[draw=orange,inner sep=0pt,rounded corners,
fit=(m-23-3) (m-24-6)
]{};
\end{tikzpicture}
%!tikz source end
\end{document}