Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58acca10 authored by Steven Toth's avatar Steven Toth Committed by Mauro Carvalho Chehab
Browse files

[media] saa7164: measure via histograms various irq and queue latencies



saa7164: measure via histograms various irq and queue latencies
Attempting to determine where buffering issues under high load are due
to highly latent irq or work queue handling.

Signed-off-by: default avatarSteven Toth <stoth@kernellabs.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 66e1d378
Loading
Loading
Loading
Loading
+38 −4
Original line number Diff line number Diff line
@@ -142,14 +142,38 @@ static void saa7164_histogram_reset(struct saa7164_histogram *hg, char *name)

	/* 200 - 2000ms x 100ms  */
	for (i = 0; i < 15; i++) {
		hg->counter1[48 + i].val = 200 + (i * 100);
		hg->counter1[48 + i].val = 200 + (i * 200);
	}

	/* Catch all massive value (1hr) */
	/* Catch all massive value (2secs) */
	hg->counter1[55].val = 2000;

	/* Catch all massive value (4secs) */
	hg->counter1[56].val = 4000;

	/* Catch all massive value (8secs) */
	hg->counter1[57].val = 8000;

	/* Catch all massive value (15secs) */
	hg->counter1[58].val = 15000;

	/* Catch all massive value (30secs) */
	hg->counter1[59].val = 30000;

	/* Catch all massive value (60secs) */
	hg->counter1[60].val = 60000;

	/* Catch all massive value (5mins) */
	hg->counter1[61].val = 300000;

	/* Catch all massive value (15mins) */
	hg->counter1[62].val = 900000;

	/* Catch all massive values (1hr) */
	hg->counter1[63].val = 3600000;
}

static void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val)
void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val)
{
	int i;
	for (i = 0; i < 64; i++ ) {
@@ -168,7 +192,7 @@ static void saa7164_histogram_print(struct saa7164_port *port,
	u32 entries = 0;
	int i;

	printk(KERN_ERR "Histogram named %s\n", hg->name);
	printk(KERN_ERR "Histogram named %s (ms, count, last_update_jiffy)\n", hg->name);
	for (i = 0; i < 64; i++ ) {
		if (hg->counter1[i].count == 0)
			continue;
@@ -285,6 +309,8 @@ static void saa7164_work_enchandler(struct work_struct *w)
		saa7164_histogram_print(port, &port->irq_interval);
		saa7164_histogram_print(port, &port->svc_interval);
		saa7164_histogram_print(port, &port->irq_svc_interval);
		saa7164_histogram_print(port, &port->read_interval);
		saa7164_histogram_print(port, &port->poll_interval);
		print_histogram = 64 + port->nr;
	}
}
@@ -731,6 +757,10 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
	saa7164_histogram_reset(&port->svc_interval, "deferred intervals");
	saa7164_histogram_reset(&port->irq_svc_interval,
		"irq to deferred intervals");
	saa7164_histogram_reset(&port->read_interval,
		"encoder read() intervals");
	saa7164_histogram_reset(&port->poll_interval,
		"encoder poll() intervals");

	return 0;
}
@@ -1016,6 +1046,10 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
		&dev->ports[ SAA7164_PORT_ENC1 ].svc_interval);
	saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
		&dev->ports[ SAA7164_PORT_ENC1 ].irq_svc_interval);
	saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
		&dev->ports[ SAA7164_PORT_ENC1 ].read_interval);
	saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
		&dev->ports[ SAA7164_PORT_ENC1 ].poll_interval);

	saa7164_shutdown(dev);

+16 −0
Original line number Diff line number Diff line
@@ -1030,6 +1030,14 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
	int rem, cnt;
	u8 *p;

	port->last_read_msecs_diff = port->last_read_msecs;
	port->last_read_msecs = jiffies_to_msecs(jiffies);
	port->last_read_msecs_diff = port->last_read_msecs -
		port->last_read_msecs_diff;

	saa7164_histogram_update(&port->read_interval,
		port->last_read_msecs_diff);

	if (*pos)
		return -ESPIPE;

@@ -1114,6 +1122,14 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
	struct saa7164_user_buffer *ubuf;
	unsigned int mask = 0;

	port->last_poll_msecs_diff = port->last_poll_msecs;
	port->last_poll_msecs = jiffies_to_msecs(jiffies);
	port->last_poll_msecs_diff = port->last_poll_msecs -
		port->last_poll_msecs_diff;

	saa7164_histogram_update(&port->poll_interval,
		port->last_poll_msecs_diff);

	if (!video_is_registered(port->v4l_device)) {
		return -EIO;
	}
+5 −0
Original line number Diff line number Diff line
@@ -328,10 +328,14 @@ struct saa7164_port {
	u32 last_irq_wp, last_svc_wp;
	u32 last_irq_rp, last_svc_rp;
	u64 last_irq_svc_msecs_diff;
	u64 last_read_msecs, last_read_msecs_diff;
	u64 last_poll_msecs, last_poll_msecs_diff;

	struct saa7164_histogram irq_interval;
	struct saa7164_histogram svc_interval;
	struct saa7164_histogram irq_svc_interval;
	struct saa7164_histogram read_interval;
	struct saa7164_histogram poll_interval;

	/* --- DVB Transport Specific --- */
	struct saa7164_dvb dvb;
@@ -441,6 +445,7 @@ void saa7164_dumpregs(struct saa7164_dev *dev, u32 addr);
void saa7164_dumphex16(struct saa7164_dev *dev, u8 *buf, int len);
void saa7164_getfirmwarestatus(struct saa7164_dev *dev);
u32 saa7164_getcurrentfirmwareversion(struct saa7164_dev *dev);
void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val);

/* ----------------------------------------------------------- */
/* saa7164-fw.c                                                */