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
0c08b65f
Commit
0c08b65f
authored
Sep 09, 2008
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Name changed from dshist
parent
b9e046d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
52 deletions
+58
-52
src/exe/rt_sevhistmon/src/rt_sevhistmon.cpp
src/exe/rt_sevhistmon/src/rt_sevhistmon.cpp
+47
-43
src/exe/rt_sevhistmon/src/rt_sevhistmon.h
src/exe/rt_sevhistmon/src/rt_sevhistmon.h
+11
-9
No files found.
src/exe/rt_sevhistmon/src/rt_sevhistmon.cpp
View file @
0c08b65f
/*
* Proview $Id: rt_sevhistmon.cpp,v 1.
1 2008-07-17 11:33:09
claes Exp $
* Proview $Id: rt_sevhistmon.cpp,v 1.
2 2008-09-09 11:24:42
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -27,13 +27,13 @@
#include "rt_qcom.h"
#include "rt_qcom_msg.h"
#include "rt_errh.h"
#include "rt_
ds
histmon.h"
#include "rt_
sev
histmon.h"
#include "rt_sev_net.h"
#include "rt_sev_msg.h"
#define sevclient_cQix 121
int
rt_
ds
histmon
::
init
()
int
rt_
sev
histmon
::
init
()
{
pwr_tStatus
sts
;
pwr_tOid
hs_oid
;
...
...
@@ -46,7 +46,7 @@ int rt_dshistmon::init()
qcom_sNode
node
;
pwr_tNid
nid
;
sts
=
gdh_Init
(
"rt_
ds
histmon"
);
sts
=
gdh_Init
(
"rt_
sev
histmon"
);
// Create a queue to server
qcom_sQattr
attr
;
...
...
@@ -86,12 +86,12 @@ int rt_dshistmon::init()
m_nodes
.
push_back
(
n
);
}
// Get all
DsHist and Ds
HistThread objects
for
(
sts
=
gdh_GetClassList
(
pwr_cClass_
Ds
HistThread
,
&
hs_oid
);
// Get all
SevHist and Sev
HistThread objects
for
(
sts
=
gdh_GetClassList
(
pwr_cClass_
Sev
HistThread
,
&
hs_oid
);
ODD
(
sts
);
sts
=
gdh_GetNextObject
(
hs_oid
,
&
hs_oid
))
{
sev_
ds
histthread
hs
;
pwr_sClass_
Ds
HistThread
*
hs_p
;
sev_
sev
histthread
hs
;
pwr_sClass_
Sev
HistThread
*
hs_p
;
m_sts
=
gdh_ObjidToPointer
(
hs_oid
,
(
void
**
)
&
hs_p
);
if
(
EVEN
(
m_sts
))
throw
co_error
(
m_sts
);
...
...
@@ -122,11 +122,11 @@ int rt_dshistmon::init()
m_hs
.
push_back
(
hs
);
}
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_
Ds
Hist
,
&
h_aref
);
for
(
sts
=
gdh_GetClassListAttrRef
(
pwr_cClass_
Sev
Hist
,
&
h_aref
);
ODD
(
sts
);
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_
Ds
Hist
,
&
h_aref
,
&
h_aref
))
{
sev_
ds
hist
h
;
pwr_sClass_
Ds
Hist
*
h_p
;
sts
=
gdh_GetNextAttrRef
(
pwr_cClass_
Sev
Hist
,
&
h_aref
,
&
h_aref
))
{
sev_
sev
hist
h
;
pwr_sClass_
Sev
Hist
*
h_p
;
int
hs_idx
;
m_sts
=
gdh_AttrRefToPointer
(
&
h_aref
,
(
void
**
)
&
h_p
);
...
...
@@ -151,13 +151,15 @@ int rt_dshistmon::init()
m_sts
=
gdh_GetAttributeCharAttrref
(
&
h_p
->
Attribute
,
&
a_tid
,
&
a_size
,
&
a_offset
,
&
a_dim
);
if
(
EVEN
(
m_sts
))
{
errh_Error
(
"Invalid
Ds
Hist Attribute %s"
,
hname
);
errh_Error
(
"Invalid
Sev
Hist Attribute %s"
,
hname
);
continue
;
}
h
.
sevid
.
nid
=
m_nodes
[
0
].
nid
;
h
.
sevid
.
rix
=
m_next_rix
++
;
h
.
storagetime
=
h_p
->
StorageTime
;
h
.
deadband
=
h_p
->
DeadBand
;
h
.
hightimeres
=
h_p
->
HighTimeResolution
;
strncpy
(
h
.
description
,
h_p
->
Description
,
sizeof
(
h
.
description
));
// Get unit from attribute object
...
...
@@ -189,7 +191,7 @@ int rt_dshistmon::init()
case
pwr_eType_Time
:
break
;
default:
errh_Error
(
"Invalid
Ds
Hist Attribute type %s"
,
hname
);
errh_Error
(
"Invalid
Sev
Hist Attribute type %s"
,
hname
);
continue
;
}
m_sts
=
gdh_AttrrefToName
(
&
h_p
->
Attribute
,
h
.
aname
,
sizeof
(
h
.
aname
),
cdh_mName_volumeStrict
);
...
...
@@ -201,7 +203,7 @@ int rt_dshistmon::init()
continue
;
}
m_hs
[
hs_idx
].
size
+=
h
.
size
;
m_hs
[
hs_idx
].
ds
histlist
.
push_back
(
h
);
m_hs
[
hs_idx
].
sev
histlist
.
push_back
(
h
);
}
connect
();
...
...
@@ -209,18 +211,18 @@ int rt_dshistmon::init()
return
1
;
}
int
rt_
ds
histmon
::
close
()
int
rt_
sev
histmon
::
close
()
{
for
(
unsigned
int
i
=
0
;
i
<
m_hs
.
size
();
i
++
)
{
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
ds
histlist
.
size
();
j
++
)
gdh_UnrefObjectInfo
(
m_hs
[
i
].
ds
histlist
[
j
].
refid
);
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
sev
histlist
.
size
();
j
++
)
gdh_UnrefObjectInfo
(
m_hs
[
i
].
sev
histlist
[
j
].
refid
);
}
m_hs
.
clear
();
return
1
;
}
int
rt_
ds
histmon
::
send_data
()
int
rt_
sev
histmon
::
send_data
()
{
qcom_sQid
tgt
;
qcom_sPut
put
;
...
...
@@ -235,7 +237,7 @@ int rt_dshistmon::send_data()
if
(
!
stime
||
m_loopcnt
%
stime
!=
0
)
continue
;
msize
=
m_hs
[
i
].
ds
histlist
.
size
()
*
(
sizeof
(
*
dp
)
-
sizeof
(
dp
->
data
))
+
m_hs
[
i
].
size
;
msize
=
m_hs
[
i
].
sev
histlist
.
size
()
*
(
sizeof
(
*
dp
)
-
sizeof
(
dp
->
data
))
+
m_hs
[
i
].
size
;
msize
+=
sizeof
(
*
msg
)
-
sizeof
(
msg
->
Data
);
msg
=
(
sev_sMsgHistDataStore
*
)
qcom_Alloc
(
&
lsts
,
msize
);
...
...
@@ -247,11 +249,11 @@ int rt_dshistmon::send_data()
clock_gettime
(
CLOCK_REALTIME
,
&
msg
->
Time
);
dp
=
(
sev_sHistData
*
)
&
msg
->
Data
;
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
ds
histlist
.
size
();
j
++
)
{
dp
->
sevid
=
m_hs
[
i
].
ds
histlist
[
j
].
sevid
;
dp
->
type
=
m_hs
[
i
].
ds
histlist
[
j
].
type
;
dp
->
size
=
m_hs
[
i
].
ds
histlist
[
j
].
size
;
memcpy
(
&
dp
->
data
,
m_hs
[
i
].
ds
histlist
[
j
].
datap
,
dp
->
size
);
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
sev
histlist
.
size
();
j
++
)
{
dp
->
sevid
=
m_hs
[
i
].
sev
histlist
[
j
].
sevid
;
dp
->
type
=
m_hs
[
i
].
sev
histlist
[
j
].
type
;
dp
->
size
=
m_hs
[
i
].
sev
histlist
[
j
].
size
;
memcpy
(
&
dp
->
data
,
m_hs
[
i
].
sev
histlist
[
j
].
datap
,
dp
->
size
);
dp
=
(
sev_sHistData
*
)((
char
*
)
dp
+
sizeof
(
*
dp
)
-
sizeof
(
dp
->
data
)
+
dp
->
size
);
}
...
...
@@ -272,7 +274,7 @@ int rt_dshistmon::send_data()
return
1
;
}
int
rt_
ds
histmon
::
connect
()
int
rt_
sev
histmon
::
connect
()
{
sev_sMsgAny
*
msg
;
qcom_sQid
tgt
;
...
...
@@ -314,7 +316,7 @@ int rt_dshistmon::connect()
return
1
;
}
int
rt_
ds
histmon
::
send_itemlist
(
pwr_tNid
nid
)
int
rt_
sev
histmon
::
send_itemlist
(
pwr_tNid
nid
)
{
int
item_cnt
=
0
;
qcom_sQid
tgt
;
...
...
@@ -327,7 +329,7 @@ int rt_dshistmon::send_itemlist( pwr_tNid nid)
// Count items for this node
for
(
unsigned
int
i
=
0
;
i
<
m_hs
.
size
();
i
++
)
{
if
(
nid
==
m_hs
[
i
].
nid
)
item_cnt
+=
m_hs
[
i
].
ds
histlist
.
size
();
item_cnt
+=
m_hs
[
i
].
sev
histlist
.
size
();
}
if
(
item_cnt
==
0
)
...
...
@@ -344,26 +346,28 @@ int rt_dshistmon::send_itemlist( pwr_tNid nid)
int
k
=
0
;
for
(
unsigned
int
i
=
0
;
i
<
m_hs
.
size
();
i
++
)
{
if
(
nid
==
m_hs
[
i
].
nid
)
{
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
ds
histlist
.
size
();
j
++
)
{
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
oid
=
m_hs
[
i
].
ds
histlist
[
j
].
aref
.
Objid
;
strcpy
(
aname
,
m_hs
[
i
].
ds
histlist
[
j
].
aname
);
for
(
unsigned
int
j
=
0
;
j
<
m_hs
[
i
].
sev
histlist
.
size
();
j
++
)
{
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
oid
=
m_hs
[
i
].
sev
histlist
[
j
].
aref
.
Objid
;
strcpy
(
aname
,
m_hs
[
i
].
sev
histlist
[
j
].
aname
);
s
=
strchr
(
aname
,
'.'
);
if
(
!
s
)
continue
;
*
s
=
0
;
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
oname
,
aname
);
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
aname
,
s
+
1
);
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
storagetime
=
m_hs
[
i
].
dshistlist
[
j
].
storagetime
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
type
=
m_hs
[
i
].
dshistlist
[
j
].
type
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
size
=
m_hs
[
i
].
dshistlist
[
j
].
size
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
sevid
=
m_hs
[
i
].
dshistlist
[
j
].
sevid
;
strcpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
attr
[
0
].
aname
,
s
+
1
);
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
storagetime
=
m_hs
[
i
].
sevhistlist
[
j
].
storagetime
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
deadband
=
m_hs
[
i
].
sevhistlist
[
j
].
deadband
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
hightimeres
=
m_hs
[
i
].
sevhistlist
[
j
].
hightimeres
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
attr
[
0
].
type
=
m_hs
[
i
].
sevhistlist
[
j
].
type
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
attr
[
0
].
size
=
m_hs
[
i
].
sevhistlist
[
j
].
size
;
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
sevid
=
m_hs
[
i
].
sevhistlist
[
j
].
sevid
;
strncpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
description
,
m_hs
[
i
].
ds
histlist
[
j
].
description
,
m_hs
[
i
].
sev
histlist
[
j
].
description
,
sizeof
(((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
0
].
description
));
strncpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
unit
,
m_hs
[
i
].
ds
histlist
[
j
].
unit
,
sizeof
(((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
0
].
unit
));
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
scantime
=
m_hs
[
i
].
ds
histlist
[
j
].
scantime
;
strncpy
(
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
attr
[
0
].
unit
,
m_hs
[
i
].
sev
histlist
[
j
].
unit
,
sizeof
(((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
0
].
attr
[
0
].
unit
));
((
sev_sMsgHistItems
*
)
put
.
data
)
->
Items
[
k
].
scantime
=
m_hs
[
i
].
sev
histlist
[
j
].
scantime
;
k
++
;
}
}
...
...
@@ -386,7 +390,7 @@ int rt_dshistmon::send_itemlist( pwr_tNid nid)
return
1
;
}
int
rt_
ds
histmon
::
mainloop
()
int
rt_
sev
histmon
::
mainloop
()
{
qcom_sQid
qid
;
int
tmo
=
1000
;
...
...
@@ -426,7 +430,7 @@ int rt_dshistmon::mainloop()
int
main
()
{
rt_
ds
histmon
client
;
rt_
sev
histmon
client
;
client
.
init
();
...
...
src/exe/rt_sevhistmon/src/rt_sevhistmon.h
View file @
0c08b65f
/*
* Proview $Id: rt_sevhistmon.h,v 1.
1 2008-07-17 11:33:09
claes Exp $
* Proview $Id: rt_sevhistmon.h,v 1.
2 2008-09-09 11:24:42
claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
...
...
@@ -17,21 +17,23 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef rt_
ds
histmon_h
#define rt_
ds
histmon_h
#ifndef rt_
sev
histmon_h
#define rt_
sev
histmon_h
#include <vector.h>
#include "pwr.h"
#include "pwr_class.h"
class
sev_
ds
hist
{
class
sev_
sev
hist
{
public:
pwr_tAttrRef
aref
;
pwr_tAName
aname
;
pwr_tRefId
refid
;
void
*
datap
;
pwr_tDeltaTime
storagetime
;
pwr_tFloat32
deadband
;
pwr_tBoolean
hightimeres
;
pwr_eType
type
;
unsigned
int
size
;
pwr_tRefId
sevid
;
...
...
@@ -40,14 +42,14 @@ class sev_dshist {
pwr_tFloat32
scantime
;
};
class
sev_
ds
histthread
{
class
sev_
sev
histthread
{
public:
pwr_tOid
oid
;
pwr_tFloat32
scantime
;
char
nodename
[
80
];
pwr_tNid
nid
;
unsigned
int
size
;
vector
<
sev_
dshist
>
ds
histlist
;
vector
<
sev_
sevhist
>
sev
histlist
;
};
class
sev_node
{
...
...
@@ -56,13 +58,13 @@ class sev_node {
char
name
[
80
];
};
class
rt_
ds
histmon
{
class
rt_
sev
histmon
{
public:
rt_
ds
histmon
()
:
m_msg_id
(
0
),
m_next_rix
(
0
),
m_loopcnt
(
0
)
{}
rt_
sev
histmon
()
:
m_msg_id
(
0
),
m_next_rix
(
0
),
m_loopcnt
(
0
)
{}
pwr_tStatus
m_sts
;
vector
<
sev_
ds
histthread
>
m_hs
;
vector
<
sev_
sev
histthread
>
m_hs
;
vector
<
sev_node
>
m_nodes
;
unsigned
int
m_msg_id
;
unsigned
int
m_next_rix
;
...
...
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