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
8ab48c43
Commit
8ab48c43
authored
Jan 11, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Sev server threads
parent
e13b730c
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
67758 additions
and
134 deletions
+67758
-134
sev/exe/sev_server/src/sev_server.cpp
sev/exe/sev_server/src/sev_server.cpp
+121
-18
sev/exe/sev_server/src/sev_server.h
sev/exe/sev_server/src/sev_server.h
+11
-5
sev/lib/sev/src/sev_db.h
sev/lib/sev/src/sev_db.h
+9
-5
sev/lib/sev/src/sev_dbhdf5.cpp
sev/lib/sev/src/sev_dbhdf5.cpp
+5
-5
sev/lib/sev/src/sev_dbhdf5.h
sev/lib/sev/src/sev_dbhdf5.h
+8
-7
sev/lib/sev/src/sev_dbms.cpp
sev/lib/sev/src/sev_dbms.cpp
+98
-49
sev/lib/sev/src/sev_dbms.h
sev/lib/sev/src/sev_dbms.h
+13
-10
sev/lib/sev/src/sev_dbsqlite.cpp
sev/lib/sev/src/sev_dbsqlite.cpp
+8
-8
sev/lib/sev/src/sev_dbsqlite.h
sev/lib/sev/src/sev_dbsqlite.h
+8
-7
sev/lib/sev/src/sev_valuecache.cpp
sev/lib/sev/src/sev_valuecache.cpp
+9
-2
sev/lib/sev/src/sev_valuecache.h
sev/lib/sev/src/sev_valuecache.h
+6
-5
src/msg/rt/src/rt_sev_msg.msg
src/msg/rt/src/rt_sev_msg.msg
+1
-0
src/wbl/pwrb/src/pwrb_c_a_sevserverthread.wb_load
src/wbl/pwrb/src/pwrb_c_a_sevserverthread.wb_load
+48
-8
src/wbl/pwrb/src/pwrb_c_a_sevstatistics.wb_load
src/wbl/pwrb/src/pwrb_c_a_sevstatistics.wb_load
+34
-4
src/wbl/pwrb/src/pwrb_c_sevserver.wb_load
src/wbl/pwrb/src/pwrb_c_sevserver.wb_load
+1
-1
xtt/exp/ge/src/pwr_c_sevserver.pwg
xtt/exp/ge/src/pwr_c_sevserver.pwg
+8029
-0
xtt/exp/ge/src/pwr_c_sevserver_threads.pwg
xtt/exp/ge/src/pwr_c_sevserver_threads.pwg
+59349
-0
No files found.
sev/exe/sev_server/src/sev_server.cpp
View file @
8ab48c43
This diff is collapsed.
Click to expand it.
sev/exe/sev_server/src/sev_server.h
View file @
8ab48c43
...
...
@@ -95,10 +95,12 @@ typedef map<int, sev_sThread *>::iterator threadlist_iterator;
class
sev_server
{
public:
sev_server
()
:
m_server_status
(
0
),
m_refid
(
0
),
m_msg_id
(
0
),
m_storage_cnt
(
0
),
m_db_type
(
sev_eDbType_Sqlite
),
m_config
(
0
),
m_thread_cnt
(
0
),
m_read_threads
(
0
)
sev_server
()
:
m_server_status
(
0
),
m_refid
(
0
),
m_msg_id
(
0
),
m_storage_cnt
(
0
),
m_write_cnt
(
0
),
m_db_type
(
sev_eDbType_Sqlite
),
m_config
(
0
),
m_thread_cnt
(
0
),
m_read_threads
(
0
),
m_thread_key_node
(
0
)
{
memset
(
&
m_stat
,
0
,
sizeof
(
m_stat
));}
~
sev_server
();
pwr_tStatus
m_sts
;
pwr_tStatus
m_server_status
;
vector
<
sev_node
>
m_nodes
;
...
...
@@ -107,12 +109,14 @@ class sev_server {
sev_db
*
m_db
;
int
m_noneth
;
unsigned
int
m_storage_cnt
;
unsigned
int
m_write_cnt
;
sev_sStat
m_stat
;
sev_eDbType
m_db_type
;
pwr_sClass_SevServer
*
m_config
;
unsigned
int
m_thread_cnt
;
pwr_tDlid
m_config_dlid
;
int
m_read_threads
;
int
m_thread_key_node
;
map
<
int
,
sev_sThread
*>
m_thread_list
;
int
init
(
int
noneth
);
...
...
@@ -120,15 +124,17 @@ class sev_server {
int
request_items
(
pwr_tNid
nid
);
int
mainloop
();
int
check_histitems
(
sev_sMsgHistItems
*
msg
,
unsigned
int
size
);
int
receive_histdata
(
sev_sMsgHistDataStore
*
msg
,
unsigned
int
size
);
int
receive_histdata
(
sev_sMsgHistDataStore
*
msg
,
unsigned
int
size
,
pwr_tNid
nid
);
int
send_histdata
(
qcom_sQid
tgt
,
sev_sMsgHistDataGetRequest
*
msg
,
unsigned
int
size
);
int
send_objecthistdata
(
qcom_sQid
tgt
,
sev_sMsgHistDataGetRequest
*
rmsg
,
unsigned
int
size
);
int
send_itemlist
(
qcom_sQid
tgt
);
int
send_server_status
(
qcom_sQid
tgt
);
int
delete_item
(
qcom_sQid
tgt
,
sev_sMsgHistItemDelete
*
rmsg
);
int
receive_events
(
sev_sMsgEventsStore
*
msg
,
unsigned
int
size
);
void
garbage_collector
();
void
garbage_item
(
int
idx
);
void
create_garbage_collector_thread
();
static
void
*
garbage_collector_thread
(
void
*
arg
);
void
garbage_collector
(
void
*
thread
);
void
garbage_item
(
void
*
thread
,
int
idx
);
void
set_dbtype
(
sev_eDbType
type
)
{
m_db_type
=
type
;}
sev_sThread
*
find_thread
(
int
key
);
static
void
*
receive_histdata_thread
(
void
*
arg
);
...
...
sev/lib/sev/src/sev_db.h
View file @
8ab48c43
...
...
@@ -72,6 +72,9 @@ typedef struct {
float
medium_load
;
float
storage_rate
;
float
medium_storage_rate
;
float
write_rate
;
float
medium_write_rate
;
float
write_quota
;
unsigned
int
datastore_msg_cnt
;
unsigned
int
dataget_msg_cnt
;
unsigned
int
items_msg_cnt
;
...
...
@@ -216,13 +219,13 @@ class sev_db {
virtual
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
)
{
*
sts
=
0
;
return
0
;}
virtual
int
store_value
(
pwr_tStatus
*
sts
,
void
*
thread
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
)
{
*
sts
=
0
;
return
0
;}
virtual
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
virtual
int
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
*
sts
=
0
;
return
0
;}
virtual
int
get_items
(
pwr_tStatus
*
sts
)
{
*
sts
=
0
;
return
0
;}
virtual
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
virtual
int
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
*
sts
=
0
;
return
0
;}
...
...
@@ -244,9 +247,9 @@ class sev_db {
virtual
int
get_objectitems
(
pwr_tStatus
*
sts
)
{
*
sts
=
0
;
return
0
;}
virtual
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
pwr_eType
type
,
unsigned
int
size
,
unsigned
int
*
idx
)
{
*
sts
=
0
;
return
0
;}
virtual
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
virtual
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
*
sts
=
0
;
return
0
;}
virtual
int
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
virtual
int
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
*
sts
=
0
;
return
0
;}
virtual
int
handle_objectchange
(
pwr_tStatus
*
sts
,
char
*
tablename
,
unsigned
int
item_idx
,
bool
newObject
)
{
*
sts
=
0
;
return
0
;}
...
...
@@ -258,6 +261,7 @@ class sev_db {
virtual
int
commit_transaction
(
void
*
thread
)
{
return
0
;}
virtual
char
*
dbName
()
{
return
0
;}
virtual
void
*
new_thread
()
{
return
0
;}
virtual
void
delete_thread
(
void
*
thread
)
{}
static
sev_db
*
open_database
(
sev_eDbType
type
,
sev_sDbConfig
*
cnf
);
static
int
get_systemname
(
char
*
name
);
...
...
sev/lib/sev/src/sev_dbhdf5.cpp
View file @
8ab48c43
...
...
@@ -2743,8 +2743,8 @@ int sev_dbhdf5::store_value( pwr_tStatus *sts, void *thread, int item_idx, int a
return
1
;
}
int
sev_dbhdf5
::
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
int
sev_dbhdf5
::
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
...
...
@@ -3713,7 +3713,7 @@ int sev_dbhdf5::delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname)
return
1
;
}
int
sev_dbhdf5
::
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
sev_dbhdf5
::
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
return
1
;
...
...
@@ -4495,7 +4495,7 @@ int sev_dbhdf5::get_objectitemattributes( pwr_tStatus *sts, sev_item *item, char
return
1
;
}
int
sev_dbhdf5
::
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
sev_dbhdf5
::
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
return
1
;
...
...
@@ -4569,7 +4569,7 @@ int sev_dbhdf5::check_deadband(pwr_eType type, unsigned int size, pwr_tFloat32 d
return
deadband_active
;
}
int
sev_dbhdf5
::
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
int
sev_dbhdf5
::
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
...
...
sev/lib/sev/src/sev_dbhdf5.h
View file @
8ab48c43
...
...
@@ -779,11 +779,11 @@ class sev_dbhdf5 : public sev_db {
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
);
int
store_value
(
pwr_tStatus
*
sts
,
void
*
thread
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
);
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
int
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
...
...
@@ -822,11 +822,12 @@ class sev_dbhdf5 : public sev_db {
int
get_objectitemattributes
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tablename
);
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
pwr_eType
type
,
unsigned
int
size
,
unsigned
int
*
idx
);
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
check_deadband
(
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
deadband
,
void
*
value
,
void
*
oldvalue
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
);
int
create_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tMask
options
,
...
...
sev/lib/sev/src/sev_dbms.cpp
View file @
8ab48c43
This diff is collapsed.
Click to expand it.
sev/lib/sev/src/sev_dbms.h
View file @
8ab48c43
...
...
@@ -92,6 +92,7 @@ class sev_dbms_env
MYSQL
*
createDb
(
void
);
MYSQL
*
openDb
(
unsigned
int
*
sts
);
MYSQL
*
open_thread
(
unsigned
int
*
sts
);
void
close_thread
(
MYSQL
*
con
);
bool
exists
()
{
return
m_exists
;}
int
close
(
void
);
static
int
get_systemname
();
...
...
@@ -143,11 +144,11 @@ class sev_dbms : public sev_db {
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
);
int
write_value
(
pwr_tStatus
*
sts
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
,
void
*
thread
);
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
int
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
...
...
@@ -188,11 +189,12 @@ class sev_dbms : public sev_db {
int
get_objectitemattributes
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tablename
);
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
pwr_eType
type
,
unsigned
int
size
,
unsigned
int
*
idx
);
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
check_deadband
(
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
deadband
,
void
*
value
,
void
*
oldvalue
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
);
int
create_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tMask
options
);
int
store_event
(
pwr_tStatus
*
sts
,
int
item_idx
,
sev_event
*
ep
);
...
...
@@ -209,11 +211,12 @@ class sev_dbms : public sev_db {
int
begin_transaction
(
void
*
thread
);
int
commit_transaction
(
void
*
thread
);
void
*
new_thread
();
int
get_closest_time
(
char
*
tablename
,
unsigned
int
options
,
pwr_tTime
*
time
,
int
before
,
unsigned
int
*
id
);
void
delete_thread
(
void
*
thread
);
int
get_closest_time
(
void
*
thread
,
char
*
tablename
,
unsigned
int
options
,
pwr_tTime
*
time
,
int
before
,
unsigned
int
*
id
);
void
string_to_mysqlstring
(
char
*
in
,
char
*
out
,
int
size
);
void
mysqlstring_to_string
(
char
*
in
,
char
*
out
,
int
size
);
int
get_id_range
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
int
get_id_range
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
pwr_tMask
options
,
unsigned
int
*
first
,
unsigned
int
*
last
);
int
get_time_range
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
pwr_tMask
options
,
pwr_tTime
*
first
,
pwr_tTime
*
last
);
...
...
sev/lib/sev/src/sev_dbsqlite.cpp
View file @
8ab48c43
...
...
@@ -1009,11 +1009,11 @@ int sev_dbsqlite::store_value( pwr_tStatus *sts, void *thread, int item_idx, int
return
1
;
}
int
sev_dbsqlite
::
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
int
sev_dbsqlite
::
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
sev_item
item
;
get_item
(
sts
,
&
item
,
oid
,
aname
);
...
...
@@ -1685,7 +1685,7 @@ int sev_dbsqlite::delete_item( pwr_tStatus *sts, pwr_tOid oid, char *aname)
return
1
;
}
int
sev_dbsqlite
::
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
sev_dbsqlite
::
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
char
query
[
300
];
...
...
@@ -2585,7 +2585,7 @@ int sev_dbsqlite::get_objectitemattributes( pwr_tStatus *sts, sev_item *item, ch
return
1
;
}
int
sev_dbsqlite
::
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
sev_dbsqlite
::
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
)
{
char
query
[
300
];
...
...
@@ -2702,7 +2702,7 @@ int sev_dbsqlite::check_deadband(pwr_eType type, unsigned int size, pwr_tFloat32
return
deadband_active
;
}
int
sev_dbsqlite
::
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
int
sev_dbsqlite
::
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
)
{
...
...
sev/lib/sev/src/sev_dbsqlite.h
View file @
8ab48c43
...
...
@@ -77,11 +77,11 @@ class sev_dbsqlite : public sev_db {
pwr_tFloat32
deadband
,
pwr_tMask
options
,
unsigned
int
*
idx
);
int
store_value
(
pwr_tStatus
*
sts
,
void
*
thread
,
int
item_idx
,
int
attr_idx
,
pwr_tTime
time
,
void
*
buf
,
unsigned
int
size
);
int
get_values
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
int
get_values
(
pwr_tStatus
*
sts
,
void
*
thread
,
pwr_tOid
oid
,
pwr_tMask
options
,
float
deadband
,
char
*
aname
,
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
scantime
,
pwr_tTime
*
creatime
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_old_data
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_data
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
delete_item
(
pwr_tStatus
*
sts
,
pwr_tOid
oid
,
char
*
aname
);
...
...
@@ -121,11 +121,12 @@ class sev_dbsqlite : public sev_db {
int
get_objectitemattributes
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
char
*
tablename
);
int
check_objectitemattr
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tOid
oid
,
char
*
aname
,
char
*
oname
,
pwr_eType
type
,
unsigned
int
size
,
unsigned
int
*
idx
);
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
char
*
tablename
,
int
delete_old_objectdata
(
pwr_tStatus
*
sts
,
void
*
thread
,
char
*
tablename
,
pwr_tMask
options
,
pwr_tTime
limit
,
pwr_tFloat32
scantime
,
pwr_tFloat32
garbagecycle
);
int
check_deadband
(
pwr_eType
type
,
unsigned
int
size
,
pwr_tFloat32
deadband
,
void
*
value
,
void
*
oldvalue
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
get_objectvalues
(
pwr_tStatus
*
sts
,
void
*
thread
,
sev_item
*
item
,
unsigned
int
size
,
pwr_tTime
*
starttime
,
pwr_tTime
*
endtime
,
int
maxsize
,
pwr_tTime
**
tbuf
,
void
**
vbuf
,
unsigned
int
*
bsize
);
int
delete_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
);
int
create_event_table
(
pwr_tStatus
*
sts
,
char
*
tablename
,
pwr_tMask
options
);
int
store_event
(
pwr_tStatus
*
sts
,
int
item_idx
,
sev_event
*
ep
);
...
...
sev/lib/sev/src/sev_valuecache.cpp
View file @
8ab48c43
...
...
@@ -44,6 +44,7 @@
#include "rt_gdh.h"
#include "pwr_baseclasses.h"
#include "sev_valuecache.h"
#include "rt_sev_msg.h"
const
int
sev_valuecache_double
::
m_size
=
VALUECACHE_SIZE
;
...
...
@@ -110,15 +111,17 @@ void sev_valuecache_double::add( void *value, pwr_tTime *t, void *thread)
calculate_epsilon
(
0
);
}
void
sev_valuecache_double
::
evaluate
(
double
maxtime
,
void
*
thread
)
int
sev_valuecache_double
::
evaluate
(
double
maxtime
,
void
*
thread
)
{
int
value_added
=
1
;
int
sts
=
SEV__NOWRITE
;
while
(
1
)
{
if
(
(
maxtime
!=
0
&&
(
m_val
[
m_last
].
time
-
m_wval
.
time
)
>
maxtime
)
||
!
check_deadband
())
{
// Store optimal value
write
(
m_last_opt_write
+
value_added
,
thread
);
sts
=
SEV__SUCCESS
;
}
else
break
;
...
...
@@ -128,6 +131,7 @@ void sev_valuecache_double::evaluate( double maxtime, void *thread)
m_last_opt_write
=
get_optimal_write
();
value_added
=
0
;
}
return
sts
;
}
void
sev_valuecache_double
::
calculate_k
()
...
...
@@ -286,11 +290,14 @@ void sev_valuecache_bool::add( void *value, pwr_tTime *t, void *thread)
}
}
void
sev_valuecache_bool
::
evaluate
(
double
maxtime
,
void
*
thread
)
int
sev_valuecache_bool
::
evaluate
(
double
maxtime
,
void
*
thread
)
{
if
(
m_val
.
val
!=
m_wval
.
val
)
{
write
(
0
,
thread
);
return
SEV__SUCCESS
;
}
return
SEV__NOWRITE
;
}
void
sev_valuecache_bool
::
write
(
int
index
,
void
*
thread
)
...
...
sev/lib/sev/src/sev_valuecache.h
View file @
8ab48c43
...
...
@@ -39,6 +39,7 @@
#include "pwr.h"
#include "co_time.h"
#include "rt_sev_msg.h"
typedef
enum
{
sev_eCvType_Point
,
...
...
@@ -69,9 +70,9 @@ class sev_valuecache {
sev_valuecache
(
const
sev_valuecache
&
x
)
:
m_type
(
x
.
m_type
),
m_userdata
(
x
.
m_userdata
),
m_useridx
(
x
.
m_useridx
),
m_write_cb
(
x
.
m_write_cb
)
{}
virtual
~
sev_valuecache
()
{};
virtual
void
add
(
void
*
value
,
pwr_tTime
*
time
,
void
*
thread
)
{}
;
virtual
void
evaluate
(
double
maxtime
,
void
*
thread
)
{};
virtual
void
write
(
int
index
,
void
*
thread
)
{}
;
virtual
void
add
(
void
*
value
,
pwr_tTime
*
time
,
void
*
thread
)
{}
virtual
int
evaluate
(
double
maxtime
,
void
*
thread
)
{
return
SEV__NOWRITE
;}
virtual
void
write
(
int
index
,
void
*
thread
)
{}
virtual
void
set_write_cb
(
void
(
*
write_cb
)(
void
*
,
int
,
void
*
,
pwr_tTime
*
,
void
*
),
void
*
userdata
,
int
idx
)
{
m_write_cb
=
write_cb
;
m_userdata
=
userdata
;
...
...
@@ -118,7 +119,7 @@ class sev_valuecache_double : public sev_valuecache {
sev_sCacheValueDouble
&
operator
[](
const
int
index
);
sev_sCacheValueDouble
&
wval
()
{
return
m_wval
;}
void
add
(
void
*
value
,
pwr_tTime
*
time
,
void
*
thread
);
void
evaluate
(
double
maxtime
,
void
*
thread
);
int
evaluate
(
double
maxtime
,
void
*
thread
);
void
calculate_k
();
void
write
(
int
index
,
void
*
thread
);
void
calculate_epsilon
();
...
...
@@ -147,7 +148,7 @@ class sev_valuecache_bool : public sev_valuecache {
~
sev_valuecache_bool
()
{}
sev_sCacheValueBool
&
wval
()
{
return
m_wval
;}
void
add
(
void
*
value
,
pwr_tTime
*
time
,
void
*
thread
);
void
evaluate
(
double
maxtime
,
void
*
thread
);
int
evaluate
(
double
maxtime
,
void
*
thread
);
void
write
(
int
index
,
void
*
thread
);
};
...
...
src/msg/rt/src/rt_sev_msg.msg
View file @
8ab48c43
...
...
@@ -55,6 +55,7 @@ range <Unable to get range> /error
unknowntype <Unknown data type> /error
nosuchtable <Table doesn't exist> /error
norows <No rows found> /error
nowrite <Nothings written> /info
.end
...
...
src/wbl/pwrb/src/pwrb_c_a_sevserverthread.wb_load
View file @
8ab48c43
...
...
@@ -54,9 +54,19 @@ SObject pwrb:Class
Attr StructName = "SevServerThread"
EndBody
!/**
! Occupied.
!*/
Object Occupied $Attribute 1
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Thread key.
!*/
Object Key $Attribute
1
Object Key $Attribute
2
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -66,7 +76,7 @@ SObject pwrb:Class
!/**
! Allocated size in thread queue.
!*/
Object QueueAlloc $Attribute
2
Object QueueAlloc $Attribute
3
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -76,7 +86,7 @@ SObject pwrb:Class
!/**
! Lost messages.
!*/
Object LostCnt $Attribute
3
Object LostCnt $Attribute
4
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -86,7 +96,7 @@ SObject pwrb:Class
!/**
! Medium load in percentage.
!*/
Object MediumLoad $Attribute
4
Object MediumLoad $Attribute
5
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -96,7 +106,7 @@ SObject pwrb:Class
!/**
! Storage rate. Values per second.
!*/
Object StorageRate $Attribute
5
Object StorageRate $Attribute
6
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -106,7 +116,37 @@ SObject pwrb:Class
!/**
! Medium storage rate. Values per second.
!*/
Object MediumStorageRate $Attribute 6
Object MediumStorageRate $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Write rate. Values per second.
!*/
Object WriteRate $Attribute 8
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Medium write rate. Values per second.
!*/
Object MediumWriteRate $Attribute 9
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Write quota in percentage.
!*/
Object WriteQuota $Attribute 10
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -116,7 +156,7 @@ SObject pwrb:Class
!/**
! Data store message count.
!*/
Object DataStoreMsgCnt $Attribute
7
Object DataStoreMsgCnt $Attribute
11
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -126,7 +166,7 @@ SObject pwrb:Class
!/**
! Event store message count.
!*/
Object EventStoreMsgCnt $Attribute
8
Object EventStoreMsgCnt $Attribute
12
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
src/wbl/pwrb/src/pwrb_c_a_sevstatistics.wb_load
View file @
8ab48c43
...
...
@@ -94,9 +94,39 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Write rate. Values per second.
!*/
Object WriteRate $Attribute 5
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Medium write rate. Values per second.
!*/
Object MediumWriteRate $Attribute 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Write quota in percentage
!*/
Object WriteQuota $Attribute 7
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
Attr Flags |= PWR_MASK_NOEDIT
Attr Flags |= PWR_MASK_STATE
EndBody
EndObject
!/**
! Data store message count.
!*/
Object DataStoreMsgCnt $Attribute
5
Object DataStoreMsgCnt $Attribute
8
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -106,7 +136,7 @@ SObject pwrb:Class
!/**
! Data get message count.
!*/
Object DataGetMsgCnt $Attribute
6
Object DataGetMsgCnt $Attribute
9
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -116,7 +146,7 @@ SObject pwrb:Class
!/**
! Items message count.
!*/
Object ItemsMsgCnt $Attribute
7
Object ItemsMsgCnt $Attribute
10
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
@@ -126,7 +156,7 @@ SObject pwrb:Class
!/**
! Event store message count.
!*/
Object EventStoreMsgCnt $Attribute
8
Object EventStoreMsgCnt $Attribute
11
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
Attr Flags |= PWR_MASK_NOEDIT
...
...
src/wbl/pwrb/src/pwrb_c_sevserver.wb_load
View file @
8ab48c43
...
...
@@ -158,7 +158,7 @@ SObject pwrb:Class
Attr TypeRef = "pwrb:Class-SevServerThread"
Attr Flags |= PWR_MASK_CLASS
Attr Flags |= PWR_MASK_ARRAY
Attr Elements =
2
0
Attr Elements =
4
0
EndBody
EndObject
EndObject
...
...
xtt/exp/ge/src/pwr_c_sevserver.pwg
0 → 100644
View file @
8ab48c43
This diff is collapsed.
Click to expand it.
xtt/exp/ge/src/pwr_c_sevserver_threads.pwg
0 → 100644
View file @
8ab48c43
This diff is collapsed.
Click to expand it.
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