Deleted Added
full compact
uipc_mbuf.c (178674) uipc_mbuf.c (178700)
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1982, 1986, 1988, 1991, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * @(#)uipc_mbuf.c 8.2 (Berkeley) 1/4/94
30 */
31
32#include <sys/cdefs.h>
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 178674 2008-04-29 21:23:21Z julian $");
33__FBSDID("$FreeBSD: head/sys/kern/uipc_mbuf.c 178700 2008-04-30 20:00:30Z julian $");
34
35#include "opt_mac.h"
36#include "opt_param.h"
37#include "opt_mbuf_stress_test.h"
38#include "opt_mbuf_profiling.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>

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

1939 }
1940 return (m0);
1941}
1942
1943#ifdef MBUF_PROFILING
1944
1945#define MP_BUCKETS 32 /* don't just change this as things may overflow.*/
1946struct mbufprofile {
34
35#include "opt_mac.h"
36#include "opt_param.h"
37#include "opt_mbuf_stress_test.h"
38#include "opt_mbuf_profiling.h"
39
40#include <sys/param.h>
41#include <sys/systm.h>

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

1939 }
1940 return (m0);
1941}
1942
1943#ifdef MBUF_PROFILING
1944
1945#define MP_BUCKETS 32 /* don't just change this as things may overflow.*/
1946struct mbufprofile {
1947 u_int64_t wasted[MP_BUCKETS];
1948 u_int64_t used[MP_BUCKETS];
1949 u_int64_t segments[MP_BUCKETS];
1947 uintmax_t wasted[MP_BUCKETS];
1948 uintmax_t used[MP_BUCKETS];
1949 uintmax_t segments[MP_BUCKETS];
1950} mbprof;
1951
1952#define MP_MAXDIGITS 21 /* strlen("16,000,000,000,000,000,000") == 21 */
1953#define MP_NUMLINES 6
1954#define MP_NUMSPERLINE 16
1955#define MP_EXTRABYTES 64 /* > strlen("used:\nwasted:\nsegments:\n") */
1956/* work out max space needed and add a bit of spare space too */
1957#define MP_MAXLINE ((MP_MAXDIGITS+1) * MP_NUMSPERLINE)

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

2001 char *c;
2002 u_int64_t *p;
2003
2004
2005 p = &mbprof.wasted[0];
2006 c = mbprofbuf;
2007 offset = snprintf(c, MP_MAXLINE + 10,
2008 "wasted:\n"
1950} mbprof;
1951
1952#define MP_MAXDIGITS 21 /* strlen("16,000,000,000,000,000,000") == 21 */
1953#define MP_NUMLINES 6
1954#define MP_NUMSPERLINE 16
1955#define MP_EXTRABYTES 64 /* > strlen("used:\nwasted:\nsegments:\n") */
1956/* work out max space needed and add a bit of spare space too */
1957#define MP_MAXLINE ((MP_MAXDIGITS+1) * MP_NUMSPERLINE)

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

2001 char *c;
2002 u_int64_t *p;
2003
2004
2005 p = &mbprof.wasted[0];
2006 c = mbprofbuf;
2007 offset = snprintf(c, MP_MAXLINE + 10,
2008 "wasted:\n"
2009 "%lld %lld %lld %lld %lld %lld %lld %lld "
2010 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2009 "%ju %ju %ju %ju %ju %ju %ju %ju "
2010 "%ju %ju %ju %ju %ju %ju %ju %ju\n",
2011 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2012 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2013#ifdef BIG_ARRAY
2014 p = &mbprof.wasted[16];
2015 c += offset;
2016 offset = snprintf(c, MP_MAXLINE,
2011 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2012 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2013#ifdef BIG_ARRAY
2014 p = &mbprof.wasted[16];
2015 c += offset;
2016 offset = snprintf(c, MP_MAXLINE,
2017 "%lld %lld %lld %lld %lld %lld %lld %lld "
2018 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2017 "%ju %ju %ju %ju %ju %ju %ju %ju "
2018 "%ju %ju %ju %ju %ju %ju %ju %ju\n",
2019 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2020 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2021#endif
2022 p = &mbprof.used[0];
2023 c += offset;
2024 offset = snprintf(c, MP_MAXLINE + 10,
2025 "used:\n"
2019 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2020 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2021#endif
2022 p = &mbprof.used[0];
2023 c += offset;
2024 offset = snprintf(c, MP_MAXLINE + 10,
2025 "used:\n"
2026 "%lld %lld %lld %lld %lld %lld %lld %lld "
2027 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2026 "%ju %ju %ju %ju %ju %ju %ju %ju "
2027 "%ju %ju %ju %ju %ju %ju %ju %ju\n",
2028 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2029 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2030#ifdef BIG_ARRAY
2031 p = &mbprof.used[16];
2032 c += offset;
2033 offset = snprintf(c, MP_MAXLINE,
2028 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2029 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2030#ifdef BIG_ARRAY
2031 p = &mbprof.used[16];
2032 c += offset;
2033 offset = snprintf(c, MP_MAXLINE,
2034 "%lld %lld %lld %lld %lld %lld %lld %lld "
2035 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2034 "%ju %ju %ju %ju %ju %ju %ju %ju "
2035 "%ju %ju %ju %ju %ju %ju %ju %ju\n",
2036 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2037 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2038#endif
2039 p = &mbprof.segments[0];
2040 c += offset;
2041 offset = snprintf(c, MP_MAXLINE + 10,
2042 "segments:\n"
2036 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2037 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2038#endif
2039 p = &mbprof.segments[0];
2040 c += offset;
2041 offset = snprintf(c, MP_MAXLINE + 10,
2042 "segments:\n"
2043 "%lld %lld %lld %lld %lld %lld %lld %lld "
2044 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2043 "%ju %ju %ju %ju %ju %ju %ju %ju "
2044 "%ju %ju %ju %ju %ju %ju %ju %ju\n",
2045 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2046 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2047#ifdef BIG_ARRAY
2048 p = &mbprof.segments[16];
2049 c += offset;
2050 offset = snprintf(c, MP_MAXLINE,
2045 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2046 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2047#ifdef BIG_ARRAY
2048 p = &mbprof.segments[16];
2049 c += offset;
2050 offset = snprintf(c, MP_MAXLINE,
2051 "%lld %lld %lld %lld %lld %lld %lld %lld "
2052 "%lld %lld %lld %lld %lld %lld %lld %lld\n",
2051 "%ju %ju %ju %ju %ju %ju %ju %ju "
2052 "%ju %ju %ju %ju %ju %ju %ju %jju",
2053 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2054 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2055#endif
2056}
2057
2058static int
2059mbprof_handler(SYSCTL_HANDLER_ARGS)
2060{

--- 32 unchanged lines hidden ---
2053 p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7],
2054 p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]);
2055#endif
2056}
2057
2058static int
2059mbprof_handler(SYSCTL_HANDLER_ARGS)
2060{

--- 32 unchanged lines hidden ---