emergency sync 2

This commit is contained in:
Ziad Arafat committed 2023-12-05 21:00:20 -07:00
1 parent 81fc0cc85a
commit 290d50b1f8
10 files changed
+177 -93

No files matched your search

+11 -3
View File
@@ -61,10 +61,8 @@ public class CountThrees implements Runnable {
// compute the elapsed time in nanoseconds
long duration = (endTime - startTime);
// convert to seconds
double seconds = (double)duration / 1_000_000_000.0;
System.out.println("Time taken: " + seconds + " seconds");
printPerformanceMetrics("executionTime", duration);
}
private int startIndex;
@@ -76,6 +74,16 @@ public class CountThrees implements Runnable {
elements = elem;
}
public static void printPerformanceMetrics(
String metric,
double value
)
{
System.out.printf("\"%s\": %f%n", metric, value);
}
// Overload of run method in the Thread class
public void run() {
// Count the number of threes