Just to elaborate on Jack's answer: on Windows, using Visual Studio up to 2013, there is a bug in the standard library which makes chrono clocks unprecise. The high resolution clock is an alias to the steady clock which is ok, but the bug is that it have a very low resolution (around 8 ms last time I checked).
Therefore, to this day (04/2014), VS standard library can't be used for measuring time or even for time-sensitive concurrent data sharing mechanisms (like when relying on condition_variable.wait_for() or this_thread::sleep_for() functions). Personally I fixed this problem by using Boost implementation instead until it's fixed. As pointed by STL (the person who is in charge of the standard library in Microsoft) in the bug report this should be fixed for the Visual Studio versions higher than 2013 (not the CTPs as they don't change the standard library).
What I mean is that your code is actually correct and cross-platform (except I would have used high_precision_clock instead), that specific implementation is buggy, but it works well with other implementations (GCC, Clang, Boost version of chrono and thread).
For example this works perfectly well on GCC 4.8 (Coliru):
#include <iostream>
#include <chrono>
#include <vector>
#include <algorithm>
auto my_array = []{
std::vector<long long> values( 100000 );
long long last_value = 0;
for( auto& value : values )
value = last_value++;
return values;
}();
void some_work()
{
for( int i = 0; i < 10000; ++i ) // play with this count
std::reverse( begin(my_array), end(my_array) );
}
int main()
{
using namespace std;
using namespace chrono;
auto start = high_resolution_clock::now();
some_work();
auto end = high_resolution_clock::now();
auto totalTime = end - start;
cout << duration_cast<microseconds>(totalTime).count()<< " microsecs \n";
return 0;
}
Coliru return "95 microsecs" for me when trying with only one cycle in some_work().