source: branches/libc-0.6/src/emx/testcase/benchmarks/loadtime.c

Last change on this file was 1235, checked in by bird, 22 years ago

..

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 1.4 KB
Line 
1#ifdef __OS2__
2#define INCL_BASE
3#endif
4#include <stdio.h>
5#include <string.h>
6#include <time.h>
7#include <dlfcn.h>
8#include "PrfTiming.h"
9
10
11int main(int argc, char **argv)
12{
13 int argi;
14
15 if (argc <= 1)
16 {
17 printf("syntax: loadtime <dll> [dll2 [..]]\n");
18 return 1;
19 }
20
21 /*
22 * Loop thru the libs.
23 */
24 for (argi = 1; argi < argc; argi++)
25 {
26 void *pv1;
27 void *pv2;
28 long double rdStart;
29 long double rdEnd;
30 long double rd;
31
32 printf("loading %s...\n", argv[argi]);
33 rdStart = gettime();
34 pv1 = dlopen(argv[argi], 0);
35 rdEnd = gettime();
36 rd = rdEnd - rdStart;
37 rd /= getHz();
38 printf("1st %f ", (double)rd); fflush(stdout);
39 if (!pv1) printf("!err! ");
40
41 rdStart = gettime();
42 pv2 = dlopen(argv[argi], 0);
43 rdEnd = gettime();
44 rd = rdEnd - rdStart;
45 rd /= getHz();
46 printf("2nd %f ", (double)rd); fflush(stdout);
47 if (!pv2) printf("!err! ");
48
49 rdStart = gettime();
50 dlclose(pv2);
51 rdEnd = gettime();
52 rd = rdEnd - rdStart;
53 rd /= getHz();
54 printf("close2 %f ", (double)rd); fflush(stdout);
55
56 rdStart = gettime();
57 dlclose(pv1);
58 rdEnd = gettime();
59 rd = rdEnd - rdStart;
60 rd /= getHz();
61 printf("close1 %f ", (double)rd);
62 printf("\n");
63 }
64
65 return 0;
66}
Note: See TracBrowser for help on using the repository browser.