aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/saa7164
diff options
context:
space:
mode:
authorSteven Toth <stoth@kernellabs.com>2010-07-31 14:10:52 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-10-21 05:54:52 -0400
commit58acca1056434dbbbcb3f1aacd759f1039a3169d (patch)
tree66661f935aae0ca46a6cba3a7daf2280acf7bd4c /drivers/media/video/saa7164
parent66e1d37884eb43214292ed433fcffb72692c4838 (diff)
[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: Steven Toth <stoth@kernellabs.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164')
-rw-r--r--drivers/media/video/saa7164/saa7164-core.c42
-rw-r--r--drivers/media/video/saa7164/saa7164-encoder.c16
-rw-r--r--drivers/media/video/saa7164/saa7164.h5
3 files changed, 59 insertions, 4 deletions
diff --git a/drivers/media/video/saa7164/saa7164-core.c b/drivers/media/video/saa7164/saa7164-core.c
index ffe71566996c..624ad3e1b61d 100644
--- a/drivers/media/video/saa7164/saa7164-core.c
+++ b/drivers/media/video/saa7164/saa7164-core.c
@@ -142,14 +142,38 @@ static void saa7164_histogram_reset(struct saa7164_histogram *hg, char *name)
142 142
143 /* 200 - 2000ms x 100ms */ 143 /* 200 - 2000ms x 100ms */
144 for (i = 0; i < 15; i++) { 144 for (i = 0; i < 15; i++) {
145 hg->counter1[48 + i].val = 200 + (i * 100); 145 hg->counter1[48 + i].val = 200 + (i * 200);
146 } 146 }
147 147
148 /* Catch all massive value (1hr) */ 148 /* Catch all massive value (2secs) */
149 hg->counter1[55].val = 2000;
150
151 /* Catch all massive value (4secs) */
152 hg->counter1[56].val = 4000;
153
154 /* Catch all massive value (8secs) */
155 hg->counter1[57].val = 8000;
156
157 /* Catch all massive value (15secs) */
158 hg->counter1[58].val = 15000;
159
160 /* Catch all massive value (30secs) */
161 hg->counter1[59].val = 30000;
162
163 /* Catch all massive value (60secs) */
164 hg->counter1[60].val = 60000;
165
166 /* Catch all massive value (5mins) */
167 hg->counter1[61].val = 300000;
168
169 /* Catch all massive value (15mins) */
170 hg->counter1[62].val = 900000;
171
172 /* Catch all massive values (1hr) */
149 hg->counter1[63].val = 3600000; 173 hg->counter1[63].val = 3600000;
150} 174}
151 175
152static void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val) 176void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val)
153{ 177{
154 int i; 178 int i;
155 for (i = 0; i < 64; i++ ) { 179 for (i = 0; i < 64; i++ ) {
@@ -168,7 +192,7 @@ static void saa7164_histogram_print(struct saa7164_port *port,
168 u32 entries = 0; 192 u32 entries = 0;
169 int i; 193 int i;
170 194
171 printk(KERN_ERR "Histogram named %s\n", hg->name); 195 printk(KERN_ERR "Histogram named %s (ms, count, last_update_jiffy)\n", hg->name);
172 for (i = 0; i < 64; i++ ) { 196 for (i = 0; i < 64; i++ ) {
173 if (hg->counter1[i].count == 0) 197 if (hg->counter1[i].count == 0)
174 continue; 198 continue;
@@ -285,6 +309,8 @@ static void saa7164_work_enchandler(struct work_struct *w)
285 saa7164_histogram_print(port, &port->irq_interval); 309 saa7164_histogram_print(port, &port->irq_interval);
286 saa7164_histogram_print(port, &port->svc_interval); 310 saa7164_histogram_print(port, &port->svc_interval);
287 saa7164_histogram_print(port, &port->irq_svc_interval); 311 saa7164_histogram_print(port, &port->irq_svc_interval);
312 saa7164_histogram_print(port, &port->read_interval);
313 saa7164_histogram_print(port, &port->poll_interval);
288 print_histogram = 64 + port->nr; 314 print_histogram = 64 + port->nr;
289 } 315 }
290} 316}
@@ -731,6 +757,10 @@ static int saa7164_port_init(struct saa7164_dev *dev, int portnr)
731 saa7164_histogram_reset(&port->svc_interval, "deferred intervals"); 757 saa7164_histogram_reset(&port->svc_interval, "deferred intervals");
732 saa7164_histogram_reset(&port->irq_svc_interval, 758 saa7164_histogram_reset(&port->irq_svc_interval,
733 "irq to deferred intervals"); 759 "irq to deferred intervals");
760 saa7164_histogram_reset(&port->read_interval,
761 "encoder read() intervals");
762 saa7164_histogram_reset(&port->poll_interval,
763 "encoder poll() intervals");
734 764
735 return 0; 765 return 0;
736} 766}
@@ -1016,6 +1046,10 @@ static void __devexit saa7164_finidev(struct pci_dev *pci_dev)
1016 &dev->ports[ SAA7164_PORT_ENC1 ].svc_interval); 1046 &dev->ports[ SAA7164_PORT_ENC1 ].svc_interval);
1017 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ], 1047 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
1018 &dev->ports[ SAA7164_PORT_ENC1 ].irq_svc_interval); 1048 &dev->ports[ SAA7164_PORT_ENC1 ].irq_svc_interval);
1049 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
1050 &dev->ports[ SAA7164_PORT_ENC1 ].read_interval);
1051 saa7164_histogram_print(&dev->ports[ SAA7164_PORT_ENC1 ],
1052 &dev->ports[ SAA7164_PORT_ENC1 ].poll_interval);
1019 1053
1020 saa7164_shutdown(dev); 1054 saa7164_shutdown(dev);
1021 1055
diff --git a/drivers/media/video/saa7164/saa7164-encoder.c b/drivers/media/video/saa7164/saa7164-encoder.c
index e340a6e39dfc..5f73ceded31b 100644
--- a/drivers/media/video/saa7164/saa7164-encoder.c
+++ b/drivers/media/video/saa7164/saa7164-encoder.c
@@ -1030,6 +1030,14 @@ static ssize_t fops_read(struct file *file, char __user *buffer,
1030 int rem, cnt; 1030 int rem, cnt;
1031 u8 *p; 1031 u8 *p;
1032 1032
1033 port->last_read_msecs_diff = port->last_read_msecs;
1034 port->last_read_msecs = jiffies_to_msecs(jiffies);
1035 port->last_read_msecs_diff = port->last_read_msecs -
1036 port->last_read_msecs_diff;
1037
1038 saa7164_histogram_update(&port->read_interval,
1039 port->last_read_msecs_diff);
1040
1033 if (*pos) 1041 if (*pos)
1034 return -ESPIPE; 1042 return -ESPIPE;
1035 1043
@@ -1114,6 +1122,14 @@ static unsigned int fops_poll(struct file *file, poll_table *wait)
1114 struct saa7164_user_buffer *ubuf; 1122 struct saa7164_user_buffer *ubuf;
1115 unsigned int mask = 0; 1123 unsigned int mask = 0;
1116 1124
1125 port->last_poll_msecs_diff = port->last_poll_msecs;
1126 port->last_poll_msecs = jiffies_to_msecs(jiffies);
1127 port->last_poll_msecs_diff = port->last_poll_msecs -
1128 port->last_poll_msecs_diff;
1129
1130 saa7164_histogram_update(&port->poll_interval,
1131 port->last_poll_msecs_diff);
1132
1117 if (!video_is_registered(port->v4l_device)) { 1133 if (!video_is_registered(port->v4l_device)) {
1118 return -EIO; 1134 return -EIO;
1119 } 1135 }
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h
index b561d6666b03..796d21df52b2 100644
--- a/drivers/media/video/saa7164/saa7164.h
+++ b/drivers/media/video/saa7164/saa7164.h
@@ -328,10 +328,14 @@ struct saa7164_port {
328 u32 last_irq_wp, last_svc_wp; 328 u32 last_irq_wp, last_svc_wp;
329 u32 last_irq_rp, last_svc_rp; 329 u32 last_irq_rp, last_svc_rp;
330 u64 last_irq_svc_msecs_diff; 330 u64 last_irq_svc_msecs_diff;
331 u64 last_read_msecs, last_read_msecs_diff;
332 u64 last_poll_msecs, last_poll_msecs_diff;
331 333
332 struct saa7164_histogram irq_interval; 334 struct saa7164_histogram irq_interval;
333 struct saa7164_histogram svc_interval; 335 struct saa7164_histogram svc_interval;
334 struct saa7164_histogram irq_svc_interval; 336 struct saa7164_histogram irq_svc_interval;
337 struct saa7164_histogram read_interval;
338 struct saa7164_histogram poll_interval;
335 339
336 /* --- DVB Transport Specific --- */ 340 /* --- DVB Transport Specific --- */
337 struct saa7164_dvb dvb; 341 struct saa7164_dvb dvb;
@@ -441,6 +445,7 @@ void saa7164_dumpregs(struct saa7164_dev *dev, u32 addr);
441void saa7164_dumphex16(struct saa7164_dev *dev, u8 *buf, int len); 445void saa7164_dumphex16(struct saa7164_dev *dev, u8 *buf, int len);
442void saa7164_getfirmwarestatus(struct saa7164_dev *dev); 446void saa7164_getfirmwarestatus(struct saa7164_dev *dev);
443u32 saa7164_getcurrentfirmwareversion(struct saa7164_dev *dev); 447u32 saa7164_getcurrentfirmwareversion(struct saa7164_dev *dev);
448void saa7164_histogram_update(struct saa7164_histogram *hg, u32 val);
444 449
445/* ----------------------------------------------------------- */ 450/* ----------------------------------------------------------- */
446/* saa7164-fw.c */ 451/* saa7164-fw.c */