Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
8923568d
Commit
8923568d
authored
Sep 15, 2006
by
Clément Stenac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move stats stuff to the per-instance object
parent
f485214f
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
56 deletions
+53
-56
include/main.h
include/main.h
+6
-9
src/input/es_out.c
src/input/es_out.c
+1
-1
src/input/input.c
src/input/input.c
+3
-3
src/input/stream.c
src/input/stream.c
+1
-1
src/libvlc.c
src/libvlc.c
+4
-4
src/misc/stats.c
src/misc/stats.c
+37
-37
src/stream_output/stream_output.c
src/stream_output/stream_output.c
+1
-1
No files found.
include/main.h
View file @
8923568d
...
...
@@ -47,13 +47,6 @@ struct libvlc_global_data_t
msg_bank_t
msg_bank
;
///< The message bank
module_bank_t
*
p_module_bank
;
///< The module bank
vlc_bool_t
b_stats
;
///< Should we collect stats
/* Timers handling */
vlc_mutex_t
timer_lock
;
///< Lock to protect timers
int
i_timers
;
///< Number of timers
counter_t
**
pp_timers
;
///< Array of all timers
intf_thread_t
*
p_probe
;
///< Devices prober
/* Arch-specific variables */
...
...
@@ -98,8 +91,12 @@ struct libvlc_int_t
void
*
(
*
pf_memcpy
)
(
void
*
,
const
void
*
,
size_t
);
void
*
(
*
pf_memset
)
(
void
*
,
int
,
size_t
);
/* Shared data - these structures are accessed directly from p_vlc by
* several modules */
/* Statistics */
vlc_bool_t
b_stats
;
///< Should we collect stats
/* Timers handling */
vlc_mutex_t
timer_lock
;
///< Lock to protect timers
int
i_timers
;
///< Number of timers
counter_t
**
pp_timers
;
///< Array of all timers
/* Locks */
vlc_mutex_t
config_lock
;
/* lock for the config file */
...
...
src/input/es_out.c
View file @
8923568d
...
...
@@ -1026,7 +1026,7 @@ static int EsOutSend( es_out_t *out, es_out_id_t *es, block_t *p_block )
else
i_delay
=
0
;
if
(
p_input
->
p_libvlc
_global
->
b_stats
)
if
(
p_input
->
p_libvlc
->
b_stats
)
{
vlc_mutex_lock
(
&
p_input
->
counters
.
counters_lock
);
stats_UpdateInteger
(
p_input
,
p_input
->
counters
.
p_demux_read
,
...
...
src/input/input.c
View file @
8923568d
...
...
@@ -685,7 +685,7 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick )
/* Prepare statistics */
#define INIT_COUNTER( p, type, compute ) p_input->counters.p_##p = \
stats_CounterCreate( p_input, VLC_VAR_##type, STATS_##compute);
if
(
p_input
->
p_libvlc
_global
->
b_stats
)
if
(
p_input
->
p_libvlc
->
b_stats
)
{
INIT_COUNTER
(
read_bytes
,
INTEGER
,
COUNTER
);
INIT_COUNTER
(
read_packets
,
INTEGER
,
COUNTER
);
...
...
@@ -721,7 +721,7 @@ static int Init( input_thread_t * p_input, vlc_bool_t b_quick )
free
(
psz
);
return
VLC_EGENERIC
;
}
if
(
p_input
->
p_libvlc
_global
->
b_stats
)
if
(
p_input
->
p_libvlc
->
b_stats
)
{
INIT_COUNTER
(
sout_sent_packets
,
INTEGER
,
COUNTER
);
INIT_COUNTER
(
sout_sent_bytes
,
INTEGER
,
COUNTER
);
...
...
@@ -1114,7 +1114,7 @@ static void End( input_thread_t * p_input )
input_EsOutDelete
(
p_input
->
p_es_out
);
#define CL_CO( c ) stats_CounterClean( p_input->counters.p_##c ); p_input->counters.p_##c = NULL;
if
(
p_input
->
p_libvlc
_global
->
b_stats
)
if
(
p_input
->
p_libvlc
->
b_stats
)
{
vlc_mutex_lock
(
&
p_input
->
counters
.
counters_lock
);
CL_CO
(
read_bytes
);
...
...
src/input/stream.c
View file @
8923568d
...
...
@@ -1655,7 +1655,7 @@ static block_t *AReadBlock( stream_t *s, vlc_bool_t *pb_eof )
{
p_block
=
p_access
->
pf_block
(
p_access
);
if
(
pb_eof
)
*
pb_eof
=
p_access
->
info
.
b_eof
;
if
(
p_input
&&
p_block
&&
p_access
->
p_libvlc
_global
->
b_stats
)
if
(
p_input
&&
p_block
&&
p_access
->
p_libvlc
->
b_stats
)
{
vlc_object_yield
(
p_input
);
vlc_mutex_lock
(
&
p_input
->
counters
.
counters_lock
);
...
...
src/libvlc.c
View file @
8923568d
...
...
@@ -714,10 +714,10 @@ int VLC_Init( int i_object, int i_argc, char *ppsz_argv[] )
p_libvlc
->
pf_memset
=
memset
;
}
libvlc_global
.
b_stats
=
config_GetInt
(
p_libvlc
,
"stats"
);
libvlc_global
.
i_timers
=
0
;
libvlc_global
.
pp_timers
=
NULL
;
vlc_mutex_init
(
p_libvlc
,
&
libvlc_global
.
timer_lock
);
p_libvlc
->
b_stats
=
config_GetInt
(
p_libvlc
,
"stats"
);
p_libvlc
->
i_timers
=
0
;
p_libvlc
->
pp_timers
=
NULL
;
vlc_mutex_init
(
p_libvlc
,
&
p_libvlc
->
timer_lock
);
/*
* Initialize hotkey handling
...
...
src/misc/stats.c
View file @
8923568d
...
...
@@ -78,7 +78,7 @@ counter_t * __stats_CounterCreate( vlc_object_t *p_this,
int
__stats_Update
(
vlc_object_t
*
p_this
,
counter_t
*
p_counter
,
vlc_value_t
val
,
vlc_value_t
*
val_new
)
{
if
(
!
p_this
->
p_libvlc
_global
->
b_stats
||
!
p_counter
)
return
VLC_EGENERIC
;
if
(
!
p_this
->
p_libvlc
->
b_stats
||
!
p_counter
)
return
VLC_EGENERIC
;
return
CounterUpdate
(
p_this
,
p_counter
,
val
,
val_new
);
}
...
...
@@ -91,7 +91,7 @@ int __stats_Update( vlc_object_t *p_this, counter_t *p_counter,
*/
int
__stats_Get
(
vlc_object_t
*
p_this
,
counter_t
*
p_counter
,
vlc_value_t
*
val
)
{
if
(
!
p_this
->
p_libvlc
_global
->
b_stats
||
!
p_counter
||
p_counter
->
i_samples
==
0
)
if
(
!
p_this
->
p_libvlc
->
b_stats
||
!
p_counter
||
p_counter
->
i_samples
==
0
)
{
val
->
i_int
=
val
->
f_float
=
0
.
0
;
return
VLC_EGENERIC
;
...
...
@@ -135,7 +135,7 @@ int __stats_Get( vlc_object_t *p_this, counter_t *p_counter, vlc_value_t *val )
void
stats_ComputeInputStats
(
input_thread_t
*
p_input
,
input_stats_t
*
p_stats
)
{
if
(
!
p_input
->
p_libvlc
_global
->
b_stats
)
return
;
if
(
!
p_input
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_input
->
counters
.
counters_lock
);
vlc_mutex_lock
(
&
p_stats
->
lock
);
...
...
@@ -223,7 +223,7 @@ void __stats_ComputeGlobalStats( vlc_object_t *p_obj, global_stats_t *p_stats )
vlc_list_t
*
p_list
;
int
i_index
;
if
(
!
p_obj
->
p_libvlc
_global
->
b_stats
)
return
;
if
(
!
p_obj
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_stats
->
lock
);
...
...
@@ -268,14 +268,14 @@ void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name,
{
int
i
;
counter_t
*
p_counter
=
NULL
;
if
(
!
p_obj
->
p_libvlc
_global
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
if
(
!
p_obj
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
_global
->
i_timers
;
i
++
)
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
->
i_timers
;
i
++
)
{
if
(
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
]
->
i_id
==
i_id
)
if
(
p_obj
->
p_libvlc
->
pp_timers
[
i
]
->
i_id
==
i_id
)
{
p_counter
=
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
];
p_counter
=
p_obj
->
p_libvlc
->
pp_timers
[
i
];
break
;
}
}
...
...
@@ -286,13 +286,13 @@ void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name,
STATS_TIMER
);
if
(
!
p_counter
)
{
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
return
;
}
p_counter
->
psz_name
=
strdup
(
psz_name
);
p_counter
->
i_id
=
i_id
;
INSERT_ELEM
(
p_obj
->
p_libvlc
_global
->
pp_timers
,
p_obj
->
p_libvlc_global
->
i_timers
,
p_obj
->
p_libvlc
_global
->
i_timers
,
p_counter
);
INSERT_ELEM
(
p_obj
->
p_libvlc
->
pp_timers
,
p_obj
->
p_libvlc
->
i_timers
,
p_obj
->
p_libvlc
->
i_timers
,
p_counter
);
/* 1st sample : if started: start_date, else last_time, b_started */
p_sample
=
(
counter_sample_t
*
)
malloc
(
sizeof
(
counter_sample_t
)
);
...
...
@@ -308,80 +308,80 @@ void __stats_TimerStart( vlc_object_t *p_obj, const char *psz_name,
if
(
p_counter
->
pp_samples
[
0
]
->
value
.
b_bool
==
VLC_TRUE
)
{
msg_Warn
(
p_obj
,
"timer %s was already started !"
,
psz_name
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
return
;
}
p_counter
->
pp_samples
[
0
]
->
value
.
b_bool
=
VLC_TRUE
;
p_counter
->
pp_samples
[
0
]
->
date
=
mdate
();
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
}
void
__stats_TimerStop
(
vlc_object_t
*
p_obj
,
unsigned
int
i_id
)
{
counter_t
*
p_counter
=
NULL
;
int
i
;
if
(
!
p_obj
->
p_libvlc
_global
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
_global
->
i_timers
;
i
++
)
if
(
!
p_obj
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
->
i_timers
;
i
++
)
{
if
(
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
]
->
i_id
==
i_id
)
if
(
p_obj
->
p_libvlc
->
pp_timers
[
i
]
->
i_id
==
i_id
)
{
p_counter
=
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
];
p_counter
=
p_obj
->
p_libvlc
->
pp_timers
[
i
];
break
;
}
}
if
(
!
p_counter
||
p_counter
->
i_samples
!=
2
)
{
msg_Err
(
p_obj
,
"timer does not exist"
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
return
;
}
p_counter
->
pp_samples
[
0
]
->
value
.
b_bool
=
VLC_FALSE
;
p_counter
->
pp_samples
[
1
]
->
value
.
i_int
+=
1
;
p_counter
->
pp_samples
[
0
]
->
date
=
mdate
()
-
p_counter
->
pp_samples
[
0
]
->
date
;
p_counter
->
pp_samples
[
1
]
->
date
+=
p_counter
->
pp_samples
[
0
]
->
date
;
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
}
void
__stats_TimerDump
(
vlc_object_t
*
p_obj
,
unsigned
int
i_id
)
{
counter_t
*
p_counter
=
NULL
;
int
i
;
if
(
!
p_obj
->
p_libvlc
_global
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
_global
->
i_timers
;
i
++
)
if
(
!
p_obj
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
->
i_timers
;
i
++
)
{
if
(
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
]
->
i_id
==
i_id
)
if
(
p_obj
->
p_libvlc
->
pp_timers
[
i
]
->
i_id
==
i_id
)
{
p_counter
=
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
];
p_counter
=
p_obj
->
p_libvlc
->
pp_timers
[
i
];
break
;
}
}
TimerDump
(
p_obj
,
p_counter
,
VLC_TRUE
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
}
void
__stats_TimersDumpAll
(
vlc_object_t
*
p_obj
)
{
int
i
;
if
(
!
p_obj
->
p_libvlc
_global
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
_global
->
i_timers
;
i
++
)
TimerDump
(
p_obj
,
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
],
VLC_FALSE
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
if
(
!
p_obj
->
p_libvlc
->
b_stats
)
return
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
for
(
i
=
0
;
i
<
p_obj
->
p_libvlc
->
i_timers
;
i
++
)
TimerDump
(
p_obj
,
p_obj
->
p_libvlc
->
pp_timers
[
i
],
VLC_FALSE
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
}
void
__stats_TimersClean
(
vlc_object_t
*
p_obj
)
{
int
i
;
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
for
(
i
=
p_obj
->
p_libvlc
_global
->
i_timers
-
1
;
i
>=
0
;
i
--
)
vlc_mutex_lock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
for
(
i
=
p_obj
->
p_libvlc
->
i_timers
-
1
;
i
>=
0
;
i
--
)
{
counter_t
*
p_counter
=
p_obj
->
p_libvlc
_global
->
pp_timers
[
i
];
REMOVE_ELEM
(
p_obj
->
p_libvlc
_global
->
pp_timers
,
p_obj
->
p_libvlc_global
->
i_timers
,
i
);
counter_t
*
p_counter
=
p_obj
->
p_libvlc
->
pp_timers
[
i
];
REMOVE_ELEM
(
p_obj
->
p_libvlc
->
pp_timers
,
p_obj
->
p_libvlc
->
i_timers
,
i
);
stats_CounterClean
(
p_counter
);
}
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
_global
->
timer_lock
);
vlc_mutex_unlock
(
&
p_obj
->
p_libvlc
->
timer_lock
);
}
void
stats_CounterClean
(
counter_t
*
p_c
)
...
...
src/stream_output/stream_output.c
View file @
8923568d
...
...
@@ -363,7 +363,7 @@ int sout_AccessOutWrite( sout_access_out_t *p_access, block_t *p_buffer )
int
i_total
=
0
;
p_access
->
i_writes
++
;
p_access
->
i_sent_bytes
+=
p_buffer
->
i_buffer
;
if
(
p_access
->
p_libvlc
_global
->
b_stats
&&
p_access
->
i_writes
%
30
==
0
)
if
(
p_access
->
p_libvlc
->
b_stats
&&
p_access
->
i_writes
%
30
==
0
)
{
/* Access_out -> sout_instance -> input_thread_t */
input_thread_t
*
p_input
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment