Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
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
Esteban Blanc
proview
Commits
3c44580d
Commit
3c44580d
authored
Apr 06, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sev server threadsave fix for queue alloc counter
parent
a26b403c
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+10
-0
sev/exe/sev_server/src/sev_server.h
sev/exe/sev_server/src/sev_server.h
+1
-0
No files found.
sev/exe/sev_server/src/sev_server.cpp
View file @
3c44580d
...
@@ -221,6 +221,8 @@ int sev_server::init( int noneth)
...
@@ -221,6 +221,8 @@ int sev_server::init( int noneth)
m_refid
=
tree_CreateTable
(
&
sts
,
sizeof
(
pwr_tRefId
),
offsetof
(
sev_sRefid
,
id
),
sizeof
(
sev_sRefid
),
100
,
sev_comp_refid
);
m_refid
=
tree_CreateTable
(
&
sts
,
sizeof
(
pwr_tRefId
),
offsetof
(
sev_sRefid
,
id
),
sizeof
(
sev_sRefid
),
100
,
sev_comp_refid
);
sts
=
thread_MutexInit
(
&
m_refid_mutex
);
sts
=
thread_MutexInit
(
&
m_refid_mutex
);
sts
=
thread_MutexInit
(
&
m_alloc_mutex
);
// Create a queue to server
// Create a queue to server
qcom_sQattr
attr
;
qcom_sQattr
attr
;
qcom_sQid
qid
;
qcom_sQid
qid
;
...
@@ -945,8 +947,11 @@ int sev_server::receive_histdata( sev_sMsgHistDataStore *msg, unsigned int size,
...
@@ -945,8 +947,11 @@ int sev_server::receive_histdata( sev_sMsgHistDataStore *msg, unsigned int size,
qmsg
->
time
=
msg
->
Time
;
qmsg
->
time
=
msg
->
Time
;
lst_Init
(
NULL
,
&
qmsg
->
h
.
e
,
qmsg
);
lst_Init
(
NULL
,
&
qmsg
->
h
.
e
,
qmsg
);
thread_MutexLock
(
&
m_alloc_mutex
);
th
->
alloc
+=
qmsg
->
h
.
size
;
th
->
alloc
+=
qmsg
->
h
.
size
;
m_total_queue_cnt
+=
qmsg
->
h
.
size
;
m_total_queue_cnt
+=
qmsg
->
h
.
size
;
thread_MutexUnlock
(
&
m_alloc_mutex
);
m_config
->
TotalQueueCnt
=
m_total_queue_cnt
;
m_config
->
TotalQueueCnt
=
m_total_queue_cnt
;
if
(
th
->
conf_idx
>=
0
)
{
if
(
th
->
conf_idx
>=
0
)
{
m_config
->
ServerThreads
[
th
->
conf_idx
].
QueueAlloc
=
th
->
alloc
;
m_config
->
ServerThreads
[
th
->
conf_idx
].
QueueAlloc
=
th
->
alloc
;
...
@@ -1257,8 +1262,11 @@ int sev_server::receive_events( sev_sMsgEventsStore *msg, unsigned int size, pwr
...
@@ -1257,8 +1262,11 @@ int sev_server::receive_events( sev_sMsgEventsStore *msg, unsigned int size, pwr
qmsg
->
num_events
=
msg
->
NumEvents
;
qmsg
->
num_events
=
msg
->
NumEvents
;
qmsg
->
item_idx
=
idx
;
qmsg
->
item_idx
=
idx
;
thread_MutexLock
(
&
m_alloc_mutex
);
th
->
alloc
+=
qmsg
->
h
.
size
;
th
->
alloc
+=
qmsg
->
h
.
size
;
m_total_queue_cnt
+=
qmsg
->
h
.
size
;
m_total_queue_cnt
+=
qmsg
->
h
.
size
;
thread_MutexUnlock
(
&
m_alloc_mutex
);
m_config
->
TotalQueueCnt
=
m_total_queue_cnt
;
m_config
->
TotalQueueCnt
=
m_total_queue_cnt
;
if
(
th
->
conf_idx
>=
0
)
{
if
(
th
->
conf_idx
>=
0
)
{
m_config
->
ServerThreads
[
th
->
conf_idx
].
QueueAlloc
=
th
->
alloc
;
m_config
->
ServerThreads
[
th
->
conf_idx
].
QueueAlloc
=
th
->
alloc
;
...
@@ -1423,10 +1431,12 @@ void *sev_server::receive_histdata_thread( void *arg)
...
@@ -1423,10 +1431,12 @@ void *sev_server::receive_histdata_thread( void *arg)
}
}
else
{
else
{
thread_MutexLock
(
&
sev
->
m_alloc_mutex
);
th
->
alloc
-=
qmsg
->
size
;
th
->
alloc
-=
qmsg
->
size
;
//if ( th->alloc < 0)
//if ( th->alloc < 0)
// th->alloc = 0;
// th->alloc = 0;
sev
->
m_total_queue_cnt
-=
qmsg
->
size
;
sev
->
m_total_queue_cnt
-=
qmsg
->
size
;
thread_MutexUnlock
(
&
sev
->
m_alloc_mutex
);
sev
->
m_config
->
TotalQueueCnt
=
sev
->
m_total_queue_cnt
;
sev
->
m_config
->
TotalQueueCnt
=
sev
->
m_total_queue_cnt
;
time_GetTime
(
&
currenttime
);
time_GetTime
(
&
currenttime
);
...
...
sev/exe/sev_server/src/sev_server.h
View file @
3c44580d
...
@@ -124,6 +124,7 @@ class sev_server {
...
@@ -124,6 +124,7 @@ class sev_server {
vector
<
sev_node
>
m_nodes
;
vector
<
sev_node
>
m_nodes
;
tree_sTable
*
m_refid
;
tree_sTable
*
m_refid
;
thread_sMutex
m_refid_mutex
;
thread_sMutex
m_refid_mutex
;
thread_sMutex
m_alloc_mutex
;
unsigned
int
m_msg_id
;
unsigned
int
m_msg_id
;
sev_db
*
m_db
;
sev_db
*
m_db
;
int
m_noneth
;
int
m_noneth
;
...
...
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