mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-17 02:07:42 +00:00
Formatting.
This commit is contained in:
parent
a6b115b35e
commit
a5408e8a4a
@ -108,57 +108,58 @@ final class AutoIngestMetricsCollector {
|
||||
static final class MetricsSnapshot {
|
||||
|
||||
private final List<JobMetric> completedJobMetrics = new ArrayList<>();
|
||||
|
||||
|
||||
/**
|
||||
* Gets a list of completed job metrics.
|
||||
*
|
||||
*
|
||||
* @return The completed job metrics.
|
||||
*/
|
||||
List<JobMetric> getCompletedJobMetrics() {
|
||||
return new ArrayList<>(completedJobMetrics);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds a new metric to the list of completed job metrics.
|
||||
*
|
||||
* @param completedDate The completed job date.
|
||||
*
|
||||
* @param completedDate The completed job date.
|
||||
* @param dataSourceSize The data source size.
|
||||
*/
|
||||
void addCompletedJobMetric(java.util.Date completedDate, long dataSourceSize) {
|
||||
completedJobMetrics.add(new JobMetric(completedDate, dataSourceSize));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* A single job metric for an auto ingest cluster.
|
||||
*/
|
||||
static final class JobMetric {
|
||||
|
||||
private final long completedDate;
|
||||
private final long dataSourceSize;
|
||||
|
||||
|
||||
/**
|
||||
* Instantiates a job metric.
|
||||
*
|
||||
* @param completedDate The job completion date.
|
||||
*
|
||||
* @param completedDate The job completion date.
|
||||
* @param dataSourceSize The data source size.
|
||||
*/
|
||||
JobMetric(java.util.Date completedDate, long dataSourceSize) {
|
||||
this.completedDate = completedDate.getTime();
|
||||
this.dataSourceSize = dataSourceSize;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the job completion date, formatted in milliseconds.
|
||||
*
|
||||
*
|
||||
* @return The job completion date.
|
||||
*/
|
||||
long getCompletedDate() {
|
||||
return completedDate;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the data source size.
|
||||
*
|
||||
*
|
||||
* @return The data source size.
|
||||
*/
|
||||
long getDataSourceSize() {
|
||||
|
@ -34,14 +34,14 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMetricsCollector.
|
||||
* Displays auto ingest metrics for a cluster.
|
||||
*/
|
||||
final class AutoIngestMetricsDialog extends javax.swing.JDialog {
|
||||
|
||||
|
||||
private static final int GIGABYTE_SIZE = 1073741824;
|
||||
|
||||
|
||||
private final AutoIngestMetricsCollector autoIngestMetricsCollector;
|
||||
|
||||
/**
|
||||
* Creates an instance of AutoIngestMetricsDialog
|
||||
*
|
||||
*
|
||||
* @param parent The parent container.
|
||||
*/
|
||||
@Messages({
|
||||
@ -62,39 +62,39 @@ final class AutoIngestMetricsDialog extends javax.swing.JDialog {
|
||||
setLocationRelativeTo(parent);
|
||||
setVisible(true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Update the metrics shown in the report text area.
|
||||
*/
|
||||
private void updateMetrics() {
|
||||
if(datePicker.getDate() == null) {
|
||||
if (datePicker.getDate() == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
AutoIngestMetricsCollector.MetricsSnapshot metricsSnapshot = autoIngestMetricsCollector.queryCoordinationServiceForMetrics();
|
||||
List<JobMetric> completedJobMetrics = metricsSnapshot.getCompletedJobMetrics();
|
||||
int jobsCompleted = 0;
|
||||
long dataSourceSizeTotal = 0;
|
||||
long pickedDate = datePicker.getDate().atStartOfDay().toEpochSecond(ZoneOffset.UTC) * 1000;
|
||||
|
||||
for(JobMetric jobMetric : completedJobMetrics) {
|
||||
if(jobMetric.getCompletedDate() >= pickedDate) {
|
||||
|
||||
for (JobMetric jobMetric : completedJobMetrics) {
|
||||
if (jobMetric.getCompletedDate() >= pickedDate) {
|
||||
jobsCompleted++;
|
||||
dataSourceSizeTotal += jobMetric.getDataSourceSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
SimpleDateFormat dateFormatter = new SimpleDateFormat("MMM d, yyyy");
|
||||
reportTextArea.setText(String.format(
|
||||
"Since %s:\n" +
|
||||
"Number of Jobs Completed: %d\n" +
|
||||
"Total Size of Data Sources: %.1f GB\n",
|
||||
"Since %s:\n"
|
||||
+ "Number of Jobs Completed: %d\n"
|
||||
+ "Total Size of Data Sources: %.1f GB\n",
|
||||
dateFormatter.format(Date.valueOf(datePicker.getDate())),
|
||||
jobsCompleted,
|
||||
(double)dataSourceSizeTotal / GIGABYTE_SIZE
|
||||
(double) dataSourceSizeTotal / GIGABYTE_SIZE
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Exception type thrown when there is an error completing an auto ingest
|
||||
* metrics dialog operation.
|
||||
@ -226,4 +226,4 @@ final class AutoIngestMetricsDialog extends javax.swing.JDialog {
|
||||
private javax.swing.JTextArea reportTextArea;
|
||||
private javax.swing.JLabel startingDataLabel;
|
||||
// End of variables declaration//GEN-END:variables
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user