]>
Commit | Line | Data |
---|---|---|
b0d623f7 A |
1 | /* |
2 | * CDDL HEADER START | |
3 | * | |
4 | * The contents of this file are subject to the terms | |
5 | * of the Common Development and Distribution License | |
6 | * (the "License"). You may not use this file except | |
7 | * in compliance with the License. | |
8 | * | |
9 | * You can obtain a copy of the license at | |
10 | * src/OPENSOLARIS.LICENSE | |
11 | * or http://www.opensolaris.org/os/licensing. | |
12 | * See the License for the specific language governing | |
13 | * permissions and limitations under the License. | |
14 | * | |
15 | * When distributing Covered Code, include this CDDL | |
16 | * HEADER in each file and include the License file at | |
17 | * usr/src/OPENSOLARIS.LICENSE. If applicable, | |
18 | * add the following below this CDDL HEADER, with the | |
19 | * fields enclosed by brackets "[]" replaced with your | |
20 | * own identifying information: Portions Copyright [yyyy] | |
21 | * [name of copyright owner] | |
22 | * | |
23 | * CDDL HEADER END | |
24 | */ | |
25 | ||
26 | /* | |
27 | * Copyright 2005 Sun Microsystems, Inc. All rights reserved. | |
28 | * Use is subject to license terms. | |
29 | */ | |
30 | ||
31 | #include <unistd.h> | |
32 | #include <stdlib.h> | |
33 | #include <stdio.h> | |
34 | #include <string.h> | |
35 | #include <signal.h> | |
36 | ||
37 | #include "libmicro.h" | |
38 | ||
39 | ||
40 | #ifdef __sun | |
41 | static void | |
42 | nop() | |
43 | { | |
44 | } | |
45 | #else | |
46 | static void | |
47 | nop(int sig) | |
48 | { | |
49 | } | |
50 | #endif | |
51 | ||
52 | int | |
53 | benchmark_init() | |
54 | { | |
55 | lm_tsdsize = 0; | |
56 | ||
57 | (void) sprintf(lm_usage, "notes: measures signal()\n"); | |
58 | ||
59 | return (0); | |
60 | } | |
61 | ||
62 | int | |
63 | benchmark_initrun() | |
64 | { | |
65 | struct sigaction act; | |
66 | ||
67 | act.sa_handler = nop; | |
68 | act.sa_flags = 0; | |
69 | ||
70 | (void) sigemptyset(&act.sa_mask); | |
71 | (void) sigaction(SIGUSR1, &act, NULL); | |
72 | ||
73 | return (0); | |
74 | } | |
75 | ||
76 | /*ARGSUSED*/ | |
77 | int | |
78 | benchmark(void *tsd, result_t *res) | |
79 | { | |
80 | int i; | |
81 | int pid; | |
82 | ||
83 | pid = getpid(); | |
84 | ||
85 | for (i = 0; i < lm_optB; i += 10) { | |
86 | (void) kill(pid, SIGUSR1); | |
87 | (void) kill(pid, SIGUSR1); | |
88 | (void) kill(pid, SIGUSR1); | |
89 | (void) kill(pid, SIGUSR1); | |
90 | (void) kill(pid, SIGUSR1); | |
91 | (void) kill(pid, SIGUSR1); | |
92 | (void) kill(pid, SIGUSR1); | |
93 | (void) kill(pid, SIGUSR1); | |
94 | (void) kill(pid, SIGUSR1); | |
95 | (void) kill(pid, SIGUSR1); | |
96 | } | |
97 | res->re_count += i; | |
98 | ||
99 | return (0); | |
100 | } |