質問編集履歴
1
ご回答を受けて修正したプログラムと実行結果
test
CHANGED
File without changes
|
test
CHANGED
@@ -123,3 +123,83 @@
|
|
123
123
|
### 補足情報(FW/ツールのバージョンなど)
|
124
124
|
|
125
125
|
ターミナル2.9.5
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
###ご回答を受けて修正したプログラムと実行結果
|
130
|
+
|
131
|
+
出力結果がよりわからなくなったのですが、どのように修正していくべきでしょうか。
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
measurement.c
|
136
|
+
|
137
|
+
```c
|
138
|
+
|
139
|
+
#include <stdio.h>
|
140
|
+
|
141
|
+
#include "rdtsc.h" %<>にすると「 'rdtsc.h' file not found with <angled> include; use "quotes" instead」というerrorが表示されました
|
142
|
+
|
143
|
+
|
144
|
+
|
145
|
+
int main(void){
|
146
|
+
|
147
|
+
unsigned long long start = rdtsc();
|
148
|
+
|
149
|
+
to_be_measured();
|
150
|
+
|
151
|
+
unsigned long long stop = rdtsc();
|
152
|
+
|
153
|
+
printf("measured time : %I64d [clock]\n", stop - start);
|
154
|
+
|
155
|
+
|
156
|
+
|
157
|
+
return 0;
|
158
|
+
|
159
|
+
}
|
160
|
+
|
161
|
+
```
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
出力
|
166
|
+
|
167
|
+
```
|
168
|
+
|
169
|
+
$ gcc -o measurement measurement.c
|
170
|
+
|
171
|
+
measurement.c:6:5: warning: implicit declaration of function 'to_be_measured' is
|
172
|
+
|
173
|
+
invalid in C99 [-Wimplicit-function-declaration]
|
174
|
+
|
175
|
+
to_be_measured();
|
176
|
+
|
177
|
+
^
|
178
|
+
|
179
|
+
measurement.c:8:30: warning: length modifier 'I64' results in undefined behavior
|
180
|
+
|
181
|
+
or no effect with 'd' conversion specifier [-Wformat]
|
182
|
+
|
183
|
+
printf("measured time : %I64d [clock]\n", stop - start);
|
184
|
+
|
185
|
+
~^~~~
|
186
|
+
|
187
|
+
2 warnings generated.
|
188
|
+
|
189
|
+
Undefined symbols for architecture x86_64:
|
190
|
+
|
191
|
+
"_rdtsc", referenced from:
|
192
|
+
|
193
|
+
_main in measurement-7e629d.o
|
194
|
+
|
195
|
+
"_to_be_measured", referenced from:
|
196
|
+
|
197
|
+
_main in measurement-7e629d.o
|
198
|
+
|
199
|
+
ld: symbol(s) not found for architecture x86_64
|
200
|
+
|
201
|
+
clang: error: linker command failed with exit code 1 (use -v to see invocation)
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
```
|