1 package org.kuali.ole.docstore.utility;
2
3 import org.kuali.ole.utility.DateTimeUtil;
4
5
6
7
8
9
10
11
12 public class BatchIngestStatistics {
13 public static String mertixHeading = null;
14
15 public long timeToConvertStringToReqObj;
16 public long timeToCreateNodesInJcr;
17 public long timeToSaveJcrSession;
18 public long ingestingTime;
19 public long timeToConvertXmlToPojo;
20 public long timeToConvertToSolrInputDocs;
21 public long timeToIndexSolrInputDocs;
22 public long timeToSolrCommit;
23 public long timeToSolrOptimize;
24 public long indexingTime;
25 public long ingestNIndexTotalTime;
26 public long batchTime;
27 public String batchStartTime;
28 public String batchEndTime;
29 public long commitSize;
30 public long recCount;
31
32
33 static {
34 mertixHeading = "\"Batch Start Time\" \t" + "\"Time To Convert String To ReqObj\" \t"
35 + "\"Time To Create Nodes In Jcr\"\t" + "\"Time To Save Jcr Session\"\t" + "\"ingesting Time\"\t"
36 + "\"Time To Convert Xml To Pojo\"\t" + "\"Time To Convert To Solr InputDocs\"\t"
37 + "\"Time To Index Solr InputDocs\"\t" + "\"Time To Solr Commit\"\t" + "\"Indexing Time\"\t"
38 + "\"Ingest N Index TotalTime\"\t" + "\"Batch Time\"\t" + "\"Batch End Time\" \t"
39 + "\"Solr Optimize Time\"";
40 }
41
42 public long getTimeToConvertStringToReqObj() {
43 return timeToConvertStringToReqObj;
44 }
45
46 public void setTimeToConvertStringToReqObj(long timeToConvertStringToReqObj) {
47 this.timeToConvertStringToReqObj = timeToConvertStringToReqObj;
48 }
49
50 public long getTimeToCreateNodesInJcr() {
51 return timeToCreateNodesInJcr;
52 }
53
54 public void setTimeToCreateNodesInJcr(long timeToCreateNodesInJcr) {
55 this.timeToCreateNodesInJcr = timeToCreateNodesInJcr;
56 }
57
58 public long getTimeToSaveJcrSession() {
59 return timeToSaveJcrSession;
60 }
61
62 public void setTimeToSaveJcrSession(long timeToSaveJcrSession) {
63 this.timeToSaveJcrSession = timeToSaveJcrSession;
64 }
65
66 public long getIngestingTime() {
67 return ingestingTime;
68 }
69
70 public void setIngestingTime(long ingestingTime) {
71 this.ingestingTime = ingestingTime;
72 }
73
74 public long getTimeToConvertXmlToPojo() {
75 return timeToConvertXmlToPojo;
76 }
77
78 public void setTimeToConvertXmlToPojo(long timeToConvertXmlToPojo) {
79 this.timeToConvertXmlToPojo = timeToConvertXmlToPojo;
80 }
81
82 public long getTimeToConvertToSolrInputDocs() {
83 return timeToConvertToSolrInputDocs;
84 }
85
86 public void setTimeToConvertToSolrInputDocs(long timeToConvertToSolrInputDocs) {
87 this.timeToConvertToSolrInputDocs = timeToConvertToSolrInputDocs;
88 }
89
90 public long getTimeToIndexSolrInputDocs() {
91 return timeToIndexSolrInputDocs;
92 }
93
94 public void setTimeToIndexSolrInputDocs(long timeToIndexSolrInputDocs) {
95 this.timeToIndexSolrInputDocs = timeToIndexSolrInputDocs;
96 }
97
98 public long getTimeToSolrCommit() {
99 return timeToSolrCommit;
100 }
101
102 public void setTimeToSolrCommit(long timeToSolrCommit) {
103 this.timeToSolrCommit = timeToSolrCommit;
104 }
105
106 public long getTimeToSolrOptimize() {
107 return timeToSolrOptimize;
108 }
109
110 public void setTimeToSolrOptimize(long timeToSolrOptimize) {
111 this.timeToSolrOptimize = timeToSolrOptimize;
112 }
113
114 public long getIndexingTime() {
115 return indexingTime;
116 }
117
118 public void setIndexingTime(long indexingTime) {
119 this.indexingTime = indexingTime;
120 }
121
122 public long getIngestNIndexTotalTime() {
123 return ingestNIndexTotalTime;
124 }
125
126 public void setIngestNIndexTotalTime(long ingestNIndexTotalTime) {
127 this.ingestNIndexTotalTime = ingestNIndexTotalTime;
128 }
129
130 public long getBatchTime() {
131 return batchTime;
132 }
133
134 public void setBatchTime(long batchTime) {
135 this.batchTime = batchTime;
136 }
137
138 public String getBatchStartTime() {
139 return batchStartTime;
140 }
141
142 public void setBatchStartTime(String batchStartTime) {
143 this.batchStartTime = batchStartTime;
144 }
145
146 public String getBatchEndTime() {
147 return batchEndTime;
148 }
149
150 public void setBatchEndTime(String batchEndTime) {
151 this.batchEndTime = batchEndTime;
152 }
153
154 public long getCommitSize() {
155 return commitSize;
156 }
157
158 public void setCommitSize(long commitSize) {
159 this.commitSize = commitSize;
160 }
161
162 public long getRecCount() {
163 return recCount;
164 }
165
166 public void setRecCount(long recCount) {
167 this.recCount = recCount;
168 }
169
170 @Override
171 public String toString() {
172 StringBuilder sb = new StringBuilder();
173 sb.append(mertixHeading);
174 BatchIngestStatistics bS = BulkIngestStatistics.getInstance().getCurrentBatch();
175 buildBatchMetric(sb, bS);
176
177 return sb.toString();
178 }
179
180 public void buildBatchMetric(StringBuilder sb, BatchIngestStatistics bS) {
181 sb.append("\n");
182 sb.append(bS.getBatchStartTime());
183 sb.append("\t");
184 sb.append(DateTimeUtil.formatTime(bS.getTimeToConvertStringToReqObj()));
185 sb.append("\t");
186 sb.append(DateTimeUtil.formatTime(bS.getTimeToCreateNodesInJcr()));
187 sb.append("\t");
188 sb.append(DateTimeUtil.formatTime(bS.getTimeToSaveJcrSession()));
189 sb.append("\t");
190 sb.append(DateTimeUtil.formatTime(bS.getIngestingTime()));
191 sb.append("\t");
192 sb.append(DateTimeUtil.formatTime(bS.getTimeToConvertXmlToPojo()));
193 sb.append("\t");
194 sb.append(DateTimeUtil.formatTime(bS.getTimeToConvertToSolrInputDocs()));
195 sb.append("\t");
196 sb.append(DateTimeUtil.formatTime(bS.getTimeToIndexSolrInputDocs()));
197 sb.append("\t");
198 sb.append(DateTimeUtil.formatTime(bS.getTimeToSolrCommit()));
199 sb.append("\t");
200 sb.append(DateTimeUtil.formatTime(bS.getIndexingTime()));
201 sb.append("\t");
202 sb.append(DateTimeUtil.formatTime(bS.getIngestNIndexTotalTime()));
203 sb.append("\t");
204 sb.append(DateTimeUtil.formatTime(bS.getBatchTime()));
205 sb.append("\t");
206 sb.append(bS.getBatchEndTime());
207 sb.append("\t");
208 sb.append(DateTimeUtil.formatTime(bS.getTimeToSolrOptimize()));
209 sb.append("\t");
210 }
211
212
213 }