Skip to content

Commit

Permalink
fix includes
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipNelson5 committed Oct 13, 2018
1 parent 83c4e68 commit a7186a6
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions CS3100_OperatingSystems/5-TheConchShell/timer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <chrono>
#include <cmath>
#include <iostream>
#include <numeric>
#include <sstream>
#include <vector>

class Timer
{
Expand All @@ -25,7 +27,8 @@ class Timer
f();
auto end = std::chrono::high_resolution_clock::now();

auto result = std::chrono::duration<double, std::milli>(end - start).count();
auto result =
std::chrono::duration<double, std::milli>(end - start).count();

times.push_back(result); // save()

Expand Down Expand Up @@ -57,15 +60,16 @@ class Timer
//return time segment
double calcTime()
{
return std::chrono::duration <double, std::milli>(_end - _start).count();
return std::chrono::duration <double, std::milli>(_end -
_start).count();
}
*/

// return string of total time
std::string ptime()
{
double total = 0.0;
for (auto &&t : times)
for (auto&& t : times)
total += t;

int s = total / 1000000;
Expand All @@ -76,8 +80,8 @@ class Timer

std::ostringstream oss;

oss << "Time spent executing child processes: " << s << " seconds " << millis
<< " milliseconds and " << micros << " microseconds";
oss << "Time spent executing child processes: " << s << " seconds "
<< millis << " milliseconds and " << micros << " microseconds";

return oss.str();
}
Expand All @@ -97,7 +101,7 @@ class Timer
{
double avg = getAverage();
double dev = 0;
for (auto &&e : times)
for (auto&& e : times)
dev += pow((e - avg), 2);
return sqrt(dev / times.size());
}
Expand Down

0 comments on commit a7186a6

Please sign in to comment.