mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-14 13:21:28 +00:00
Make status less cpu consuming
Original commit message from CVS: Make status less cpu consuming
This commit is contained in:
parent
00f78d264b
commit
aed1e95e9b
2 changed files with 20 additions and 8 deletions
|
@ -29,18 +29,22 @@ run_test (GstBin *pipeline, gint iters)
|
|||
{
|
||||
gint vm = 0;
|
||||
gint maxiters = iters;
|
||||
gint prev_percent = -1;
|
||||
|
||||
count = 0;
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
|
||||
while (iters) {
|
||||
gint newvm = vmsize();
|
||||
gint percent;
|
||||
|
||||
if (newvm - vm > VM_THRES) {
|
||||
g_print ("\r%d (delta %d) ", newvm, newvm - vm);
|
||||
percent = (gint)((maxiters-iters+1)*100.0/maxiters);
|
||||
|
||||
if (percent != prev_percent || newvm - vm > VM_THRES) {
|
||||
g_print ("\r%d (delta %d) %.3d%% ", newvm, newvm - vm, percent);
|
||||
prev_percent = percent;
|
||||
vm = newvm;
|
||||
}
|
||||
g_print ("\b\b\b\b\b\b%.3d%% ", (gint)((maxiters-iters+1)*100.0/maxiters));
|
||||
gst_bin_iterate (pipeline);
|
||||
|
||||
if (iters > 0) iters--;
|
||||
|
@ -55,7 +59,7 @@ main (int argc, char *argv[])
|
|||
GstElement *sink;
|
||||
GstElement *bs;
|
||||
GstElement *pipeline;
|
||||
gint i, testnum = 1;
|
||||
gint testnum = 1;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -138,4 +142,6 @@ main (int argc, char *argv[])
|
|||
|
||||
g_print ("\n\ndone\n");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
|
@ -29,18 +29,22 @@ run_test (GstBin *pipeline, gint iters)
|
|||
{
|
||||
gint vm = 0;
|
||||
gint maxiters = iters;
|
||||
gint prev_percent = -1;
|
||||
|
||||
count = 0;
|
||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||
|
||||
while (iters) {
|
||||
gint newvm = vmsize();
|
||||
gint percent;
|
||||
|
||||
if (newvm - vm > VM_THRES) {
|
||||
g_print ("\r%d (delta %d) ", newvm, newvm - vm);
|
||||
percent = (gint)((maxiters-iters+1)*100.0/maxiters);
|
||||
|
||||
if (percent != prev_percent || newvm - vm > VM_THRES) {
|
||||
g_print ("\r%d (delta %d) %.3d%% ", newvm, newvm - vm, percent);
|
||||
prev_percent = percent;
|
||||
vm = newvm;
|
||||
}
|
||||
g_print ("\b\b\b\b\b\b%.3d%% ", (gint)((maxiters-iters+1)*100.0/maxiters));
|
||||
gst_bin_iterate (pipeline);
|
||||
|
||||
if (iters > 0) iters--;
|
||||
|
@ -55,7 +59,7 @@ main (int argc, char *argv[])
|
|||
GstElement *sink;
|
||||
GstElement *bs;
|
||||
GstElement *pipeline;
|
||||
gint i, testnum = 1;
|
||||
gint testnum = 1;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -138,4 +142,6 @@ main (int argc, char *argv[])
|
|||
|
||||
g_print ("\n\ndone\n");
|
||||
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue