This website works better with JavaScript.
Home
Explore
帮助
返回水杉在线
登录水杉在线
登录水杉码园
10213903403
/
os_kernel_lab
Watch
1
Star
0
Fork
0
Code
Issues
0
Pull Requests
0
Releases
0
Wiki
Activity
Browse Source
add linux little progs for locality
main
yuchen
9 years ago
parent
1dc0d0aa01
commit
2f904a1306
4 changed files
with
38 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+7
-0
related_info/lab3/locality/Makefile
+12
-0
related_info/lab3/locality/badlocality.c
+12
-0
related_info/lab3/locality/goodlocality.c
+7
-0
related_info/lab3/locality/locality.md
+ 7
- 0
related_info/lab3/locality/Makefile
View File
@ -0,0 +1,7 @@
all
:
goodlocality
badlocality
goodlocality
:
gcc -O0 -g -o goodlocality goodlocality.c
badlocality
:
gcc -O0 -g -o badlocality badlocality.c
clean
:
rm goodlocality badlocality
+ 12
- 0
related_info/lab3/locality/badlocality.c
View File
@ -0,0 +1,12 @@
#
include
<stdio.h>
#
define NUM 1024
#
define COUNT 10
int
A
[
NUM
]
[
NUM
]
;
void
main
(
void
)
{
int
i
,
j
,
k
;
for
(
k
=
0
;
k
<
COUNT
;
k
+
+
)
for
(
j
=
0
;
j
<
NUM
;
j
+
+
)
for
(
i
=
0
;
i
<
NUM
;
i
+
+
)
A
[
i
]
[
j
]
=
0
;
printf
(
"
%d count computing over!
\n
"
,
i
*
j
*
k
)
;
}
+ 12
- 0
related_info/lab3/locality/goodlocality.c
View File
@ -0,0 +1,12 @@
#
include
<stdio.h>
#
define NUM 1024
#
define COUNT 10
int
A
[
NUM
]
[
NUM
]
;
void
main
(
void
)
{
int
i
,
j
,
k
;
for
(
k
=
0
;
k
<
COUNT
;
k
+
+
)
for
(
i
=
0
;
i
<
NUM
;
i
+
+
)
for
(
j
=
0
;
j
<
NUM
;
j
+
+
)
A
[
i
]
[
j
]
=
i
+
j
;
printf
(
"
%d count computing over!
\n
"
,
i
*
j
*
k
)
;
}
+ 7
- 0
related_info/lab3/locality/locality.md
View File
@ -0,0 +1,7 @@
#在linux下分析程序的局部性
可通过如下命令在时间上看出在执行时间上的差异
```
make
time ./goodlocality
time ./badlocality
```
Write
Preview
Loading…
Cancel
Save