Deleted Added
full compact
perfmon.c (50476) perfmon.c (209455)
1/*
2 * Copyright 1996 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
1/*
2 * Copyright 1996 Massachusetts Institute of Technology
3 *
4 * Permission to use, copy, modify, and distribute this software and
5 * its documentation for any purpose and without fee is hereby
6 * granted, provided that both the above copyright notice and this
7 * permission notice appear in all copies, that both the above
8 * copyright notice and this permission notice appear in all

--- 12 unchanged lines hidden (view full) ---

21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * $FreeBSD: head/share/examples/perfmon/perfmon.c 50476 1999-08-28 00:22:10Z peter $
29 * $FreeBSD: head/share/examples/perfmon/perfmon.c 209455 2010-06-23 04:42:47Z kevlo $
30 */
31
32#include <sys/types.h>
33#include <sys/ioctl.h>
34
35#include <machine/cpu.h>
36#include <machine/perfmon.h>
37

--- 130 unchanged lines hidden (view full) ---

168{
169 char *ep;
170 long l;
171
172 errno = 0;
173 l = strtol(buf, &ep, 0);
174 if (*buf && !*ep && !errno) {
175 if (l < min || l > max) {
30 */
31
32#include <sys/types.h>
33#include <sys/ioctl.h>
34
35#include <machine/cpu.h>
36#include <machine/perfmon.h>
37

--- 130 unchanged lines hidden (view full) ---

168{
169 char *ep;
170 long l;
171
172 errno = 0;
173 l = strtol(buf, &ep, 0);
174 if (*buf && !*ep && !errno) {
175 if (l < min || l > max) {
176 errx(1, "`%s': must be between %d and %d",
176 errx(1, "%s: must be between %d and %d",
177 buf, min, max);
178 }
179 return (int)l;
177 buf, min, max);
178 }
179 return (int)l;
180 } else if(errno) {
181 errx(1, "`%s': must be between %ld and %ld",
182 LONG_MIN, LONG_MAX);
183 }
184 errx(1, "`%s': parameter must be an integer");
180 }
181
182 errx(1, "%s: parameter must be an integer", buf);
185}
186
187static void
188usage(const char *pname)
189{
190 fprintf(stderr,
191 "usage: %s [-eiou] [-c command] [-l nloops] [-m mask] [-s sleeptime]\n"
192 " [-U unit] counter\n",
193 pname);
194 exit(1);
195}
183}
184
185static void
186usage(const char *pname)
187{
188 fprintf(stderr,
189 "usage: %s [-eiou] [-c command] [-l nloops] [-m mask] [-s sleeptime]\n"
190 " [-U unit] counter\n",
191 pname);
192 exit(1);
193}