MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / main

Function main

test/matrix_multiply.cpp:85–129  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85int main(int argc, char **argv)
86{
87 if (argc < 7)
88 {
89 printf("Usage: matrix_multiply A B C NumFrames ItersPerFrame Method\n");
90 printf("Method is one of: 0=setTimeout, 1=requestAnimationFrame, 2=setImmediate\n");
91 A = 100;
92 B = 20;
93 C = 100;
94 NumFrames = 10;
95 ItersPerFrame = 1000;
96 Method = 2;
97 printf("Not enough parameters specified. Running with defaults: A=%d B=%d C=%d NumFrames=%d ItersPerFrame=%d Method=%d.\n", A, B, C, NumFrames, ItersPerFrame, Method);
98 }
99 else
100 {
101 A = atoi(argv[1]);
102 B = atoi(argv[2]);
103 C = atoi(argv[3]);
104 NumFrames = atoi(argv[4]);
105 ItersPerFrame = atoi(argv[5]);
106 Method = atoi(argv[6]);
107 }
108 printf("Performing %d multiplications of matrices of size %dx%d and %dx%d. Distributing multiplication across %d animation frames (matrix muls per frame=%d).\n", NumFrames*ItersPerFrame, A, B, B, C, NumFrames, ItersPerFrame);
109
110 mA = new float[A*B];
111 mB = new float[B*C];
112 mDst = new float[A*C];
113 Init(mA, A, B);
114 Init(mB, B, C);
115
116 t0 = tick();
117
118 if (!ENVIRONMENT_IS_WEB)
119 {
120 for(int i = 0; i < NumFrames; ++i)
121 Tick();
122 }
123 if (NumFramesDone != NumFrames) {
124 puts("Invalid number of frames");
125 abort();
126 }
127
128 return 0;
129}

Callers

nothing calls this directly

Calls 7

printfFunction · 0.85
atoiFunction · 0.85
TickFunction · 0.85
putsFunction · 0.85
InitFunction · 0.70
tickFunction · 0.50
abortFunction · 0.50

Tested by

no test coverage detected