CernVM-FS  2.12.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 <utility>
#include <vector>
#include "util/atomic.h"
#include "util/export.h"
#include "util/murmur.hxx"
#include "util/platform.h"
#include "util/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

CVMFS_EXPORT double DiffTimeSeconds (struct timeval start, struct timeval end)
 
template<typename T >
void SetBit (unsigned int bit, T *field)
 
template<typename T >
void ClearBit (unsigned int bit, T *field)
 
template<typename T >
bool TestBit (unsigned int bit, const T field)
 
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

template<typename T >
void ClearBit ( unsigned int  bit,
T *  field 
)
inline

Definition at line 36 of file algorithm.h.

Referenced by cvmfs::cvmfs_read(), and cvmfs::cvmfs_release().

Here is the caller graph for this function:

CVMFS_EXPORT 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 >
void SetBit ( unsigned int  bit,
T *  field 
)
inline

Definition at line 31 of file algorithm.h.

Referenced by cvmfs::FillOpenFlags().

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 50 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 68 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:

template<typename T >
bool TestBit ( unsigned int  bit,
const T  field 
)
inline

Definition at line 41 of file algorithm.h.

Referenced by cvmfs::cvmfs_release(), and cvmfs::FillOpenFlags().

Here is the caller graph for this function: