Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
8adc1d83
Commit
8adc1d83
authored
Apr 20, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(netflow, flowd aggregate) add profile support, replace deepcopy for cheaper copy
parent
8872e1c7
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
2 deletions
+18
-2
flowd_aggregate.py
src/opnsense/scripts/netflow/flowd_aggregate.py
+18
-2
No files found.
src/opnsense/scripts/netflow/flowd_aggregate.py
View file @
8adc1d83
...
...
@@ -74,7 +74,7 @@ def aggregate_flowd(do_vacuum=False):
for
stream_agg_object
in
stream_agg_objects
:
# class add() may change the flow contents for processing, its better to isolate
# paremeters here.
flow_record_cpy
=
copy
.
deep
copy
(
flow_record
)
flow_record_cpy
=
copy
.
copy
(
flow_record
)
stream_agg_object
.
add
(
flow_record_cpy
)
prev_recv
=
flow_record
[
'recv'
]
...
...
@@ -164,7 +164,23 @@ class Main(object):
if
len
(
sys
.
argv
)
>
1
and
'console'
in
sys
.
argv
[
1
:]:
# command line start
Main
()
if
'profile'
in
sys
.
argv
[
1
:]:
# start with profiling
import
cProfile
import
StringIO
import
pstats
pr
=
cProfile
.
Profile
(
builtins
=
False
)
pr
.
enable
()
Main
()
pr
.
disable
()
s
=
StringIO
.
StringIO
()
sortby
=
'cumulative'
ps
=
pstats
.
Stats
(
pr
,
stream
=
s
)
.
sort_stats
(
sortby
)
ps
.
print_stats
()
print
s
.
getvalue
()
else
:
Main
()
else
:
# Daemonize flowd aggregator
daemon
=
Daemonize
(
app
=
"flowd_aggregate"
,
pid
=
'/var/run/flowd_aggregate.pid'
,
action
=
Main
)
...
...
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