MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / test

Function test

applications/test/HashingSpeed/Test-HashingSpeed.C:1036–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1034#define NTESTS 5000000
1035
1036double test (hashFn hash) {
1037static char buff[BUFF_SZ];
1038clock_t c0, c1;
1039int32_t i;
1040
1041 for (buff[0]=0, i=1; i < BUFF_SZ; i++) buff[i] = (char) (i + buff[i-1]);
1042
1043 c0 = clock ();
1044 for (i=0; i < NTESTS; i++) hash (buff, BUFF_SZ);
1045 c1 = clock ();
1046 return (c1 - c0)*(1.0 / (double)CLOCKS_PER_SEC);
1047}
1048
1049struct tagtest {
1050 double res;

Callers 1

mainFunction · 0.70

Calls 2

clockClass · 0.85
hashClass · 0.50

Tested by

no test coverage detected