Project

General

Profile

Bug #7563 ยป netstat.patch

Denis Kozadaev, 2016-11-10 02:22 PM

View differences:

usr/src/cmd/cmd-inet/usr.bin/netstat/netstat.c Thu Nov 10 17:03:34 2016
5602 5602
 * named 'name*'.
5603 5603
 */
5604 5604
static void
5605
kmem_cache_stats(char *title, char *name, int prefix, int64_t *total_bytes)
5605
kmem_cache_stats(char *title, char *name, int prefix, uint64_t *total_bytes)
5606 5606
{
5607 5607
	int len;
5608
	int alloc;
5609
	int64_t total_alloc = 0;
5610
	int alloc_fail, total_alloc_fail = 0;
5611
	int buf_size = 0;
5612
	int buf_avail;
5613
	int buf_total;
5614
	int buf_max, total_buf_max = 0;
5615
	int buf_inuse, total_buf_inuse = 0;
5608
	uint64_t alloc;
5609
	uint64_t total_alloc = 0;
5610
	uint64_t alloc_fail, total_alloc_fail = 0;
5611
	uint64_t buf_size = 0;
5612
	uint64_t buf_avail;
5613
	uint64_t buf_total;
5614
	uint64_t buf_max, total_buf_max = 0;
5615
	uint64_t buf_inuse, total_buf_inuse = 0;
5616 5616
	kstat_t *ksp;
5617 5617
	char buf[256];
5618 5618

  
......
5658 5658
		if (Vflag && prefix) {
5659 5659
			(void) snprintf(buf, sizeof (buf), "%s%s", title,
5660 5660
			    ksp->ks_name + len);
5661
			(void) printf("    %-18s %6u %9u %11u %11u\n",
5661
			(void) printf("    %-18s %6llu %9llu %11llu %11llu\n",
5662 5662
			    buf, buf_inuse, buf_max, alloc, alloc_fail);
5663 5663
		}
5664 5664

  
......
5666 5666
		total_alloc_fail	+= alloc_fail;
5667 5667
		total_buf_max		+= buf_max;
5668 5668
		total_buf_inuse		+= buf_inuse;
5669
		*total_bytes		+= (int64_t)buf_inuse * buf_size;
5669
		*total_bytes		+= buf_inuse * buf_size;
5670 5670
	} /* 'for' loop 1 ends */
5671 5671

  
5672 5672
	if (buf_size == 0) {
......
5680 5680
	else
5681 5681
		(void) snprintf(buf, sizeof (buf), "%s", title);
5682 5682

  
5683
	(void) printf("%-22s %6d %9d %11lld %11d\n", buf,
5683
	(void) printf("%-22s %6llu %9llu %11llu %11llu\n", buf,
5684 5684
	    total_buf_inuse, total_buf_max, total_alloc, total_alloc_fail);
5685 5685
}
5686 5686

  
5687 5687
static void
5688 5688
m_report(void)
5689 5689
{
5690
	int64_t total_bytes = 0;
5690
	uint64_t total_bytes = 0;
5691 5691

  
5692 5692
	(void) puts("streams allocation:");
5693 5693
	(void) printf("%63s\n", "cumulative  allocation");
......
5703 5703
	kmem_cache_stats("syncq", "syncq_cache", 0, &total_bytes);
5704 5704
	kmem_cache_stats("qband", "qband_cache", 0, &total_bytes);
5705 5705

  
5706
	(void) printf("\n%lld Kbytes allocated for streams data\n",
5706
	(void) printf("\n%llu Kbytes allocated for streams data\n",
5707 5707
	    total_bytes / 1024);
5708 5708

  
5709 5709
	(void) putchar('\n');
    (1-1/1)