| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
#ifndef ANDROID_BENCH_H |
| 18 |
#define ANDROID_BENCH_H |
| 19 |
|
| 20 |
#include <pthread.h> |
| 21 |
|
| 22 |
#include "WorkerPool.h" |
| 23 |
|
| 24 |
#include <string.h> |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
class Bench { |
| 29 |
public: |
| 30 |
Bench(); |
| 31 |
~Bench(); |
| 32 |
|
| 33 |
struct GFlop { |
| 34 |
int kernelXSize; |
| 35 |
|
| 36 |
int imageXSize; |
| 37 |
|
| 38 |
|
| 39 |
float *srcBuffer; |
| 40 |
float *kernelBuffer; |
| 41 |
float *dstBuffer; |
| 42 |
|
| 43 |
|
| 44 |
}; |
| 45 |
GFlop mGFlop; |
| 46 |
|
| 47 |
bool init(); |
| 48 |
|
| 49 |
bool runPowerManagementTest(uint64_t options); |
| 50 |
bool runCPUHeatSoak(uint64_t options); |
| 51 |
|
| 52 |
bool startMemTests(); |
| 53 |
void endMemTests(); |
| 54 |
float runMemoryBandwidthTest(uint64_t options); |
| 55 |
float runMemoryLatencyTest(uint64_t options); |
| 56 |
|
| 57 |
float runGFlopsTest(uint64_t options); |
| 58 |
|
| 59 |
void getData(float *data, size_t count) const; |
| 60 |
|
| 61 |
|
| 62 |
void finish(); |
| 63 |
|
| 64 |
void setPriority(int32_t p); |
| 65 |
void destroyWorkerThreadResources(); |
| 66 |
|
| 67 |
uint64_t getTimeNanos() const; |
| 68 |
uint64_t getTimeMillis() const; |
| 69 |
|
| 70 |
|
| 71 |
|
| 72 |
bool incTimeBucket() const; |
| 73 |
|
| 74 |
|
| 75 |
protected: |
| 76 |
WorkerPool mWorkers; |
| 77 |
|
| 78 |
bool mExit; |
| 79 |
bool mPaused; |
| 80 |
|
| 81 |
static void testWork(void *usr, uint32_t idx); |
| 82 |
|
| 83 |
private: |
| 84 |
uint8_t * volatile mMemSrc; |
| 85 |
uint8_t * volatile mMemDst; |
| 86 |
size_t mMemLoopCount; |
| 87 |
size_t mMemLatencyLastSize; |
| 88 |
|
| 89 |
|
| 90 |
float ** mIpKernel; |
| 91 |
float * volatile * mSrcBuf; |
| 92 |
float * volatile * mOutBuf; |
| 93 |
uint32_t * mTimeBucket; |
| 94 |
|
| 95 |
uint64_t mTimeStartNanos; |
| 96 |
uint64_t mTimeEndNanos; |
| 97 |
uint64_t mTimeBucketDivisor; |
| 98 |
uint32_t mTimeBuckets; |
| 99 |
|
| 100 |
uint64_t mTimeEndGroupNanos; |
| 101 |
|
| 102 |
bool initIP(); |
| 103 |
void GflopKernelC(); |
| 104 |
void GflopKernelC_y3(); |
| 105 |
|
| 106 |
bool allocateBuckets(size_t); |
| 107 |
|
| 108 |
|
| 109 |
}; |
| 110 |
|
| 111 |
|
| 112 |
#endif |