Skip to content
This repository was archived by the owner on Sep 27, 2019. It is now read-only.

Commit 3d66d13

Browse files
authored
This is a manual merge of #1161 except that I took out the changes to WorkerPool. (#1391)
1. Refactored Timer to add the ability to record the total time. 2. @haoxianghua -- solve issues #754, write delete_sql_test.cpp to check correctness
1 parent f6446ba commit 3d66d13

File tree

6 files changed

+173
-412
lines changed

6 files changed

+173
-412
lines changed

src/include/common/timer.h

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ typedef std::chrono::time_point<clock_> time_point_;
3030
template <typename ResolutionRatio = std::ratio<1> >
3131
class Timer : public peloton::Printable {
3232
public:
33-
Timer() : elapsed_(0), invocations_(0) {}
33+
Timer() : elapsed_(0), total_(0), invocations_(0) {}
3434

3535
inline void Start() { begin_ = clock_::now(); }
3636

@@ -43,16 +43,33 @@ class Timer : public peloton::Printable {
4343
.count();
4444

4545
elapsed_ += duration;
46+
total_ += duration;
4647
invocations_++;
4748
}
4849

49-
inline void Reset() { elapsed_ = 0; }
50-
51-
// Get Elapsed duration
52-
inline double GetDuration() const { return elapsed_; }
53-
54-
// Get Number of invocations
55-
inline int GetInvocations() const { return invocations_; }
50+
/**
51+
* Reset the current elapsed time counter.
52+
*/
53+
void Reset() { elapsed_ = 0; }
54+
55+
/**
56+
* Get elapsed duration
57+
* @return
58+
*/
59+
double GetDuration() const { return elapsed_; }
60+
61+
/**
62+
* Return the total amount of time measured by
63+
* this timer after multiple invocations.
64+
* @return
65+
*/
66+
double GetTotalDuration() const { return (total_); }
67+
68+
/**
69+
* Get number of invocations
70+
* @return
71+
*/
72+
int GetInvocations() const { return invocations_; }
5673

5774
// Get a string representation for debugging
5875
inline const std::string GetInfo() const {
@@ -73,6 +90,11 @@ class Timer : public peloton::Printable {
7390
// Elapsed time (with desired resolution)
7491
double elapsed_;
7592

93+
/**
94+
* Total amount of time (even after resets)
95+
*/
96+
double total_;
97+
7698
// Number of invocations
7799
int invocations_;
78100
};

test/executor/create_index_test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
//
33
// Peloton
44
//
5-
// delete_test.cpp
5+
// create_index_test.cpp
66
//
77
// Identification: test/executor/create_index_test.cpp
88
//
9-
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
9+
// Copyright (c) 2015-2018, Carnegie Mellon University Database Group
1010
//
1111
//===----------------------------------------------------------------------===//
1212

0 commit comments

Comments
 (0)