CernVM-FS  2.10.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
algorithm.h File Reference
#include <sys/time.h>
#include <algorithm>
#include <string>
#include <vector>
#include "atomic.h"
#include "murmur.hxx"
#include "platform.h"
#include "prng.h"
#include "util/single_copy.h"
Include dependency graph for algorithm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hash_murmur< hashed_type >
 
class  StopWatch
 
class  Log2Histogram
 
class  UTLog2Histogram
 
class  HighPrecisionTimer
 

Functions

double DiffTimeSeconds (struct timeval start, struct timeval end)
 
template<typename T >
std::vector< T > Shuffle (const std::vector< T > &input, Prng *prng)
 
template<typename T , typename U >
void SortTeam (std::vector< T > *tractor, std::vector< U > *towed)
 

Function Documentation

double DiffTimeSeconds ( struct timeval  start,
struct timeval  end 
)

This file is part of the CernVM File System.

Definition at line 31 of file algorithm.cc.

Referenced by StopWatch::GetTime(), download::DownloadManager::MainDownload(), and download::DownloadManager::ProbeHosts().

Here is the caller graph for this function:

template<typename T >
std::vector<T> Shuffle ( const std::vector< T > &  input,
Prng prng 
)

Knuth's random shuffle algorithm.

Definition at line 33 of file algorithm.h.

Referenced by download::DownloadManager::GeoSortServers().

Here is the call graph for this function:

Here is the caller graph for this function:

template<typename T , typename U >
void SortTeam ( std::vector< T > *  tractor,
std::vector< U > *  towed 
)

Sorts the vector tractor and applies the same permutation to towed. Both vectors have to be of the same size. Type T must be sortable (< operator). Uses insertion sort (n^2), only efficient for small vectors.

Definition at line 51 of file algorithm.h.

Referenced by ListDirectory(), download::DownloadManager::ProbeGeo(), and download::DownloadManager::ProbeHosts().

Here is the call graph for this function:

Here is the caller graph for this function: