Lines Matching refs:perf
41 static int wait_sample(struct msm_perf_state *perf) in wait_sample() argument
45 if (time_after(perf->next_jiffies, start_jiffies)) { in wait_sample()
47 perf->next_jiffies - start_jiffies; in wait_sample()
54 perf->next_jiffies += SAMPLE_TIME; in wait_sample()
58 static int refill_buf(struct msm_perf_state *perf) in refill_buf() argument
60 struct msm_drm_private *priv = perf->dev->dev_private; in refill_buf()
62 char *ptr = perf->buf; in refill_buf()
63 int rem = sizeof(perf->buf); in refill_buf()
66 if ((perf->cnt++ % 32) == 0) { in refill_buf()
86 ret = wait_sample(perf); in refill_buf()
114 perf->bufpos = 0; in refill_buf()
115 perf->buftot = ptr - perf->buf; in refill_buf()
123 struct msm_perf_state *perf = file->private_data; in perf_read() local
126 mutex_lock(&perf->read_lock); in perf_read()
128 if (perf->bufpos >= perf->buftot) { in perf_read()
129 ret = refill_buf(perf); in perf_read()
134 n = min((int)sz, perf->buftot - perf->bufpos); in perf_read()
135 if (copy_to_user(buf, &perf->buf[perf->bufpos], n)) { in perf_read()
140 perf->bufpos += n; in perf_read()
144 mutex_unlock(&perf->read_lock); in perf_read()
152 struct msm_perf_state *perf = inode->i_private; in perf_open() local
153 struct drm_device *dev = perf->dev; in perf_open()
163 if (perf->open) { in perf_open()
168 file->private_data = perf; in perf_open()
169 perf->open = true; in perf_open()
170 perf->cnt = 0; in perf_open()
171 perf->buftot = 0; in perf_open()
172 perf->bufpos = 0; in perf_open()
174 perf->next_jiffies = jiffies + SAMPLE_TIME; in perf_open()
183 struct msm_perf_state *perf = inode->i_private; in perf_release() local
184 struct msm_drm_private *priv = perf->dev->dev_private; in perf_release()
186 perf->open = false; in perf_release()
202 struct msm_perf_state *perf; in msm_perf_debugfs_init() local
205 if (priv->perf) in msm_perf_debugfs_init()
208 perf = kzalloc(sizeof(*perf), GFP_KERNEL); in msm_perf_debugfs_init()
209 if (!perf) in msm_perf_debugfs_init()
212 perf->dev = minor->dev; in msm_perf_debugfs_init()
214 mutex_init(&perf->read_lock); in msm_perf_debugfs_init()
215 priv->perf = perf; in msm_perf_debugfs_init()
218 perf, &perf_debugfs_fops); in msm_perf_debugfs_init()
224 struct msm_perf_state *perf = priv->perf; in msm_perf_debugfs_cleanup() local
226 if (!perf) in msm_perf_debugfs_cleanup()
229 priv->perf = NULL; in msm_perf_debugfs_cleanup()
231 mutex_destroy(&perf->read_lock); in msm_perf_debugfs_cleanup()
233 kfree(perf); in msm_perf_debugfs_cleanup()