repo.or.cz
/
GalaxyCodeBases.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
modified: Makefile
[GalaxyCodeBases.git]
/
perl
/
etc
/
justonce
/
tmp
/
stressCPU.pl
blob
30b261ac8abf0d8551e719fdc4a3c933dc92b3c0
1
#!/usr/bin/perl
2
use
strict
;
3
use
warnings
;
4
use
threads
;
5
6
my
$t
=
shift
;
7
8
my
%thread
;
9
foreach
(
1
..
$t
) {
10
$thread
{
$_
} =
threads
->
new
(
\
&
test
,
$_
);
11
}
12
13
my
%count
;
14
foreach
(
sort keys
%thread
) {
15
$count
{
$_
} =
$thread
{
$_
}->
join
;
16
}
17
18
sub
test
{
19
my
$in
=
shift
;
20
my
$a
;
21
while
(
$in
) {
22
++
$a
;
23
--
$a
;
24
}
25
}