This project has retired. For details please refer to its
Attic page.
PartitionStats xref
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.giraph.partition;
19
20 import java.io.DataInput;
21 import java.io.DataOutput;
22 import java.io.IOException;
23
24 import org.apache.hadoop.io.Writable;
25
26
27
28
29
30 public class PartitionStats implements Writable {
31
32 private int partitionId = -1;
33
34 private long vertexCount = 0;
35
36 private long finishedVertexCount = 0;
37
38 private long edgeCount = 0;
39
40 private long messagesSentCount = 0;
41
42 private long messageBytesSentCount = 0;
43
44
45
46
47 private long computeMs;
48
49 private String workerHostnameId;
50
51
52
53
54 public PartitionStats() { }
55
56
57
58
59
60
61
62
63
64
65
66
67 public PartitionStats(int partitionId,
68 long vertexCount,
69 long finishedVertexCount,
70 long edgeCount,
71 long messagesSentCount,
72 long messageBytesSentCount,
73 String workerHostnameId) {
74 this.partitionId = partitionId;
75 this.vertexCount = vertexCount;
76 this.finishedVertexCount = finishedVertexCount;
77 this.edgeCount = edgeCount;
78 this.messagesSentCount = messagesSentCount;
79 this.messageBytesSentCount = messageBytesSentCount;
80 this.workerHostnameId = workerHostnameId;
81 }
82
83
84
85
86
87
88 public void setPartitionId(int partitionId) {
89 this.partitionId = partitionId;
90 }
91
92
93
94
95
96
97 public int getPartitionId() {
98 return partitionId;
99 }
100
101
102
103
104 public void incrVertexCount() {
105 ++vertexCount;
106 }
107
108
109
110
111
112
113 public long getVertexCount() {
114 return vertexCount;
115 }
116
117
118
119
120 public void incrFinishedVertexCount() {
121 ++finishedVertexCount;
122 }
123
124
125
126
127
128
129 public long getFinishedVertexCount() {
130 return finishedVertexCount;
131 }
132
133
134
135
136
137
138 public void addEdgeCount(long edgeCount) {
139 this.edgeCount += edgeCount;
140 }
141
142
143
144
145
146
147 public long getEdgeCount() {
148 return edgeCount;
149 }
150
151
152
153
154
155
156 public void addMessagesSentCount(long messagesSentCount) {
157 this.messagesSentCount += messagesSentCount;
158 }
159
160
161
162
163
164
165 public long getMessagesSentCount() {
166 return messagesSentCount;
167 }
168
169
170
171
172
173
174 public void addMessageBytesSentCount(long messageBytesSentCount) {
175 this.messageBytesSentCount += messageBytesSentCount;
176 }
177
178
179
180
181
182
183 public long getMessageBytesSentCount() {
184 return messageBytesSentCount;
185 }
186
187 public long getComputeMs() {
188 return computeMs;
189 }
190
191 public void setComputeMs(long computeMs) {
192 this.computeMs = computeMs;
193 }
194
195 public String getWorkerHostnameId() {
196 return workerHostnameId;
197 }
198
199 @Override
200 public void readFields(DataInput input) throws IOException {
201 partitionId = input.readInt();
202 vertexCount = input.readLong();
203 finishedVertexCount = input.readLong();
204 edgeCount = input.readLong();
205 messagesSentCount = input.readLong();
206 messageBytesSentCount = input.readLong();
207 computeMs = input.readLong();
208 workerHostnameId = input.readUTF();
209 }
210
211 @Override
212 public void write(DataOutput output) throws IOException {
213 output.writeInt(partitionId);
214 output.writeLong(vertexCount);
215 output.writeLong(finishedVertexCount);
216 output.writeLong(edgeCount);
217 output.writeLong(messagesSentCount);
218 output.writeLong(messageBytesSentCount);
219 output.writeLong(computeMs);
220 output.writeUTF(workerHostnameId);
221 }
222
223 @Override
224 public String toString() {
225 return "(id=" + partitionId + ",vtx=" + vertexCount + ",finVtx=" +
226 finishedVertexCount + ",edges=" + edgeCount + ",msgsSent=" +
227 messagesSentCount + ",msgBytesSent=" +
228 messageBytesSentCount + ",computeMs=" + computeMs +
229 ")";
230 }
231 }