diff options
author | Qiyu8 <fangchunlin@huawei.com> | 2020-10-26 10:25:05 +0800 |
---|---|---|
committer | Qiyu8 <fangchunlin@huawei.com> | 2020-10-26 10:25:05 +0800 |
commit | f917c26e83e040270cb98488b296a5c85cbb5ffb (patch) | |
tree | 6f2b6faa9b19ce305c7cd12fe168d1f5cb5c6857 /benchmark/imax.c | |
parent | dd6ebdfdab65e5235da4887c943f7639639d19af (diff) | |
download | openblas-f917c26e83e040270cb98488b296a5c85cbb5ffb.tar.gz openblas-f917c26e83e040270cb98488b296a5c85cbb5ffb.tar.bz2 openblas-f917c26e83e040270cb98488b296a5c85cbb5ffb.zip |
Refractoring remaining benchmark cases.
Diffstat (limited to 'benchmark/imax.c')
-rw-r--r-- | benchmark/imax.c | 80 |
1 files changed, 4 insertions, 76 deletions
diff --git a/benchmark/imax.c b/benchmark/imax.c index b56ef64ba..b96b17167 100644 --- a/benchmark/imax.c +++ b/benchmark/imax.c @@ -25,13 +25,7 @@ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*****************************************************************************/
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef __CYGWIN32__
-#include <sys/time.h>
-#endif
-#include "common.h"
-
+#include "bench.h"
#undef IMAX
@@ -43,71 +37,6 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif
#endif
-#if defined(__WIN32__) || defined(__WIN64__)
-
-#ifndef DELTA_EPOCH_IN_MICROSECS
-#define DELTA_EPOCH_IN_MICROSECS 11644473600000000ULL
-#endif
-
-int gettimeofday(struct timeval *tv, void *tz){
-
- FILETIME ft;
- unsigned __int64 tmpres = 0;
- static int tzflag;
-
- if (NULL != tv)
- {
- GetSystemTimeAsFileTime(&ft);
-
- tmpres |= ft.dwHighDateTime;
- tmpres <<= 32;
- tmpres |= ft.dwLowDateTime;
-
- /*converting file time to unix epoch*/
- tmpres /= 10; /*convert into microseconds*/
- tmpres -= DELTA_EPOCH_IN_MICROSECS;
- tv->tv_sec = (long)(tmpres / 1000000UL);
- tv->tv_usec = (long)(tmpres % 1000000UL);
- }
-
- return 0;
-}
-
-#endif
-
-#if !defined(__WIN32__) && !defined(__WIN64__) && !defined(__CYGWIN32__) && 0
-
-static void *huge_malloc(BLASLONG size){
- int shmid;
- void *address;
-
-#ifndef SHM_HUGETLB
-#define SHM_HUGETLB 04000
-#endif
-
- if ((shmid =shmget(IPC_PRIVATE,
- (size + HUGE_PAGESIZE) & ~(HUGE_PAGESIZE - 1),
- SHM_HUGETLB | IPC_CREAT |0600)) < 0) {
- printf( "Memory allocation failed(shmget).\n");
- exit(1);
- }
-
- address = shmat(shmid, NULL, SHM_RND);
-
- if ((BLASLONG)address == -1){
- printf( "Memory allocation failed(shmat).\n");
- exit(1);
- }
-
- shmctl(shmid, IPC_RMID, 0);
-
- return address;
-}
-
-#define malloc huge_malloc
-
-#endif
-
int main(int argc, char *argv[]){
FLOAT *x;
@@ -121,7 +50,6 @@ int main(int argc, char *argv[]){ int to = 200;
int step = 1;
- struct timeval start, stop;
double time1,timeg;
argc--;argv++;
@@ -160,13 +88,13 @@ int main(int argc, char *argv[]){ x[i] = ((FLOAT) rand() / (FLOAT) RAND_MAX) - 0.5;
}
- gettimeofday( &start, (struct timezone *)0);
+ begin();
IMAX (&m, x, &inc_x);
- gettimeofday( &stop, (struct timezone *)0);
+ end();
- time1 = (double)(stop.tv_sec - start.tv_sec) + (double)((stop.tv_usec - start.tv_usec)) * 1.e-6;
+ time1 = getsec();
timeg += time1;
|