Get the long longs out of the Thrift codebase
Summary: Replace with int64_t and don't worry about what architecture machine you're on, the typedefed int64_t will do the right thing.
Reviewed By: aditya, marc
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665123 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/concurrency/test/Tests.cpp b/lib/cpp/src/concurrency/test/Tests.cpp
index f4b0b62..5fe4651 100644
--- a/lib/cpp/src/concurrency/test/Tests.cpp
+++ b/lib/cpp/src/concurrency/test/Tests.cpp
@@ -53,8 +53,8 @@
std::cout << "\t\tUtil minimum time" << std::endl;
- long long time00 = Util::currentTime();
- long long time01 = Util::currentTime();
+ int64_t time00 = Util::currentTime();
+ int64_t time01 = Util::currentTime();
std::cout << "\t\t\tMinimum time: " << time01 - time00 << "ms" << std::endl;
@@ -92,7 +92,7 @@
size_t taskCount = 100000;
- long long delay = 10LL;
+ int64_t delay = 10LL;
std::cout << "\t\tThreadManager load test: worker count: " << workerCount << " task count: " << taskCount << " delay: " << delay << std::endl;
@@ -119,7 +119,7 @@
size_t tasksPerWorker = 1000;
- long long delay = 10LL;
+ int64_t delay = 10LL;
for (size_t workerCount = minWorkerCount; workerCount < maxWorkerCount; workerCount*= 2) {
diff --git a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
index 2e2dbdd..f7d607a 100644
--- a/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadFactoryTests.h
@@ -228,11 +228,11 @@
/** See how accurate monitor timeout is. */
- bool monitorTimeoutTest(size_t count=1000, long long timeout=10) {
+ bool monitorTimeoutTest(size_t count=1000, int64_t timeout=10) {
Monitor monitor;
- long long startTime = Util::currentTime();
+ int64_t startTime = Util::currentTime();
for (size_t ix = 0; ix < count; ix++) {
{
@@ -244,7 +244,7 @@
}
}
- long long endTime = Util::currentTime();
+ int64_t endTime = Util::currentTime();
double error = ((endTime - startTime) - (count * timeout)) / (double)(count * timeout);
diff --git a/lib/cpp/src/concurrency/test/ThreadManagerTests.h b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
index 89e6843..5f518ca 100644
--- a/lib/cpp/src/concurrency/test/ThreadManagerTests.h
+++ b/lib/cpp/src/concurrency/test/ThreadManagerTests.h
@@ -36,7 +36,7 @@
public:
- Task(Monitor& monitor, size_t& count, long long timeout) :
+ Task(Monitor& monitor, size_t& count, int64_t timeout) :
_monitor(monitor),
_count(count),
_timeout(timeout),
@@ -78,9 +78,9 @@
Monitor& _monitor;
size_t& _count;
- long long _timeout;
- long long _startTime;
- long long _endTime;
+ int64_t _timeout;
+ int64_t _startTime;
+ int64_t _endTime;
bool _done;
Monitor _sleep;
};
@@ -90,7 +90,7 @@
* completes. Verify that all tasks completed and that thread manager cleans
* up properly on delete.
*/
- bool loadTest(size_t count=100, long long timeout=100LL, size_t workerCount=4) {
+ bool loadTest(size_t count=100, int64_t timeout=100LL, size_t workerCount=4) {
Monitor monitor;
@@ -113,7 +113,7 @@
tasks.insert(shared_ptr<ThreadManagerTests::Task>(new ThreadManagerTests::Task(monitor, activeCount, timeout)));
}
- long long time00 = Util::currentTime();
+ int64_t time00 = Util::currentTime();
for (std::set<shared_ptr<ThreadManagerTests::Task> >::iterator ix = tasks.begin(); ix != tasks.end(); ix++) {
@@ -129,20 +129,20 @@
}
}
- long long time01 = Util::currentTime();
+ int64_t time01 = Util::currentTime();
- long long firstTime = 9223372036854775807LL;
- long long lastTime = 0;
+ int64_t firstTime = 9223372036854775807LL;
+ int64_t lastTime = 0;
double averageTime = 0;
- long long minTime = 9223372036854775807LL;
- long long maxTime = 0;
+ int64_t minTime = 9223372036854775807LL;
+ int64_t maxTime = 0;
for (std::set<shared_ptr<ThreadManagerTests::Task> >::iterator ix = tasks.begin(); ix != tasks.end(); ix++) {
shared_ptr<ThreadManagerTests::Task> task = *ix;
- long long delta = task->_endTime - task->_startTime;
+ int64_t delta = task->_endTime - task->_startTime;
assert(delta > 0);
@@ -222,7 +222,7 @@
* Block test. Create pendingTaskCountMax tasks. Verify that we block adding the
* pendingTaskCountMax + 1th task. Verify that we unblock when a task completes */
- bool blockTest(long long timeout=100LL, size_t workerCount=2) {
+ bool blockTest(int64_t timeout=100LL, size_t workerCount=2) {
bool success = false;
diff --git a/lib/cpp/src/concurrency/test/TimerManagerTests.h b/lib/cpp/src/concurrency/test/TimerManagerTests.h
index 0041d9c..e7948e4 100644
--- a/lib/cpp/src/concurrency/test/TimerManagerTests.h
+++ b/lib/cpp/src/concurrency/test/TimerManagerTests.h
@@ -31,7 +31,7 @@
class Task: public Runnable {
public:
- Task(Monitor& monitor, long long timeout) :
+ Task(Monitor& monitor, int64_t timeout) :
_timeout(timeout),
_startTime(Util::currentTime()),
_monitor(monitor),
@@ -46,7 +46,7 @@
// Figure out error percentage
- long long delta = _endTime - _startTime;
+ int64_t delta = _endTime - _startTime;
delta = delta > _timeout ? delta - _timeout : _timeout - delta;
@@ -66,9 +66,9 @@
}
}
- long long _timeout;
- long long _startTime;
- long long _endTime;
+ int64_t _timeout;
+ int64_t _startTime;
+ int64_t _endTime;
Monitor& _monitor;
bool _success;
bool _done;
@@ -80,7 +80,7 @@
* properly clean up itself and the remaining orphaned timeout task when the
* manager goes out of scope and its destructor is called.
*/
- bool test00(long long timeout=1000LL) {
+ bool test00(int64_t timeout=1000LL) {
shared_ptr<TimerManagerTests::Task> orphanTask = shared_ptr<TimerManagerTests::Task>(new TimerManagerTests::Task(_monitor, 10 * timeout));