1*ce099b40Smartin /* $NetBSD: softint1.c,v 1.2 2008/04/28 20:23:07 martin Exp $ */
2a33059bbSad
3a33059bbSad /*-
4a33059bbSad * Copyright (c) 2007 The NetBSD Foundation, Inc.
5a33059bbSad * All rights reserved.
6a33059bbSad *
7a33059bbSad * This code is derived from software contributed to The NetBSD Foundation
8a33059bbSad * by Andrew Doran.
9a33059bbSad *
10a33059bbSad * Redistribution and use in source and binary forms, with or without
11a33059bbSad * modification, are permitted provided that the following conditions
12a33059bbSad * are met:
13a33059bbSad * 1. Redistributions of source code must retain the above copyright
14a33059bbSad * notice, this list of conditions and the following disclaimer.
15a33059bbSad * 2. Redistributions in binary form must reproduce the above copyright
16a33059bbSad * notice, this list of conditions and the following disclaimer in the
17a33059bbSad * documentation and/or other materials provided with the distribution.
18a33059bbSad *
19a33059bbSad * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20a33059bbSad * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21a33059bbSad * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22a33059bbSad * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23a33059bbSad * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24a33059bbSad * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25a33059bbSad * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26a33059bbSad * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27a33059bbSad * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28a33059bbSad * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29a33059bbSad * POSSIBILITY OF SUCH DAMAGE.
30a33059bbSad */
31a33059bbSad
32a33059bbSad /*
33a33059bbSad * Force sched_pstats() to block by acquiring proclist_lock.
34a33059bbSad */
35a33059bbSad
36a33059bbSad #include <unistd.h>
37a33059bbSad #include <stdio.h>
38a33059bbSad #include <pthread.h>
39a33059bbSad
40a33059bbSad void *thread(void *);
41a33059bbSad
42a33059bbSad int desc;
43a33059bbSad
44a33059bbSad void *
thread(void * arg)45a33059bbSad thread(void *arg)
46a33059bbSad {
47a33059bbSad
48a33059bbSad for (;;) {
49a33059bbSad (void)getppid();
50a33059bbSad }
51a33059bbSad
52a33059bbSad return NULL;
53a33059bbSad }
54a33059bbSad
55a33059bbSad int
main(int argc,char ** argv)56a33059bbSad main(int argc, char **argv)
57a33059bbSad {
58a33059bbSad pthread_t thr;
59a33059bbSad int nt;
60a33059bbSad
61a33059bbSad for (nt = sysconf(_SC_NPROCESSORS_ONLN); nt > 0; nt--) {
62a33059bbSad pthread_create(&thr, NULL, thread, NULL);
63a33059bbSad }
64a33059bbSad sleep(60);
65a33059bbSad printf("Check output of vmstat -e for \"softint clk block\".\n");
66a33059bbSad
67a33059bbSad return 0;
68a33059bbSad }
69