Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
f252f537
Commit
f252f537
authored
Jun 28, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(VMonitor): сделал вывод переменных "в два столбца" (вместо одного)
parent
d534a6f8
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
21 deletions
+110
-21
uniset2-vmonit
Utilities/Admin/uniset2-vmonit
+9
-3
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+38
-10
libuniset2.spec
conf/libuniset2.spec
+4
-1
TestProc.cc
extensions/tests/SMemoryTest/TestProc.cc
+1
-1
Debug.h
include/Debug.h
+1
-1
VMonitor.h
include/VMonitor.h
+1
-0
VMonitor.cc
src/Various/VMonitor.cc
+56
-5
No files found.
Utilities/Admin/uniset2-vmonit
View file @
f252f537
...
...
@@ -14,8 +14,9 @@ print_usage()
{
[
"
$1
"
=
0
]
||
exec
>
&2
echo
"Usage:
${
0
##*/
}
[-s watch_sec | -d] ObjectID1[@node],ObjectID2,.."
echo
"Usage:
${
0
##*/
}
[-s watch_sec | -d
| -c confile.xml
] ObjectID1[@node],ObjectID2,.."
echo
" -d - dump state. Print state and exit"
echo
" -c confile - Set confile."
# echo ""
# uniset2-admin --help
...
...
@@ -27,14 +28,19 @@ print_usage()
#parse command line options
dump
=
confile
=
case
"
$1
"
in
-h
|
--help
)
print_usage 0
;;
-s
|
--sec
)
shift
;
WATCH_SEC
=
$1
;
shift
;;
-d
|
--dump
)
dump
=
1
;
shift
;;
-c
|
--confile
)
shift
;
confile
=
$1
;
shift
;;
esac
OID
=
$1
shift
[
-z
"
$dump
"
]
&&
$WATCH
-n
$WATCH_SEC
uniset2-admin
--oinfo
${
OID
}
$*
[
-n
"
$dump
"
]
&&
uniset2-admin
--oinfo
${
OID
}
$*
[
-n
"
$confile
"
]
&&
confile
=
"--confile
$confile
"
[
-z
"
$dump
"
]
&&
$WATCH
-n
$WATCH_SEC
uniset2-admin
$confile
--oinfo
${
OID
}
$*
[
-n
"
$dump
"
]
&&
uniset2-admin
$confile
--oinfo
${
OID
}
$*
Utilities/codegen/ctl-cpp-common.xsl
View file @
f252f537
...
...
@@ -434,7 +434,9 @@ UniSetTypes::SimpleInfo* <xsl:value-of select="$CLASSNAME"/>_SK::getInfo()
inf
<<
i->info
<<
endl;
inf
<<
"LogServer: "
<<
logserv_host
<<
":"
<<
logserv_port
<<
endl;
inf
<<
dumpIO()
<<
endl;
inf
<<
endl;
inf
<<
vmon.pretty_str()
<<
endl;
inf
<<
endl;
inf
<<
getMonitInfo()
<<
endl;
i->info = inf.str().c_str();
...
...
@@ -1020,14 +1022,26 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
{
ostringstream s;
s
<<
myname
<<
": "
<<
endl;
std::vector
<
std::string
>
v;
ostringstream s1;
<xsl:for-each
select=
"//smap/item"
>
s
<<
" "
<<
setw(30)
<<
std::right
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
"
s1.str("");
s1
<<
" "
<<
setw(30)
<<
std::right
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
"
<<
"("
<<
setw(30)
<<
std::left
<<
ORepHelpers::getShortName( uniset_conf()->oind->getMapName(
<xsl:value-of
select=
"@name"
/>
))
<<
")"
<<
std::right
<<
" = "
<<
setw(6)
<<
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
<<
endl
;
<<
std::right
<<
" = "
<<
setw(6)
<<
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
;
v.push_back(s1.str())
;
</xsl:for-each>
return s.str();
int n = 0;
for( const auto
&
e: v )
{
s
<<
e;
if( (n++)%2 )
s
<<
std::endl;
}
return std::move(s.str());
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
...
...
@@ -1038,7 +1052,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( UniSetTypes::ObjectId
{
s
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
";
if( showLinkName ) s
<<
"("
<<
ORepHelpers::getShortName( uniset_conf()->oind->getMapName(
<xsl:value-of
select=
"@name"
/>
))
<<
")";
return s
.str(
);
return s
td::move(s.str()
);
}
</xsl:for-each>
return "";
...
...
@@ -1054,7 +1068,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::strval( UniSetTypes::Object
s
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
";
if( showLinkName ) s
<<
"("
<<
ORepHelpers::getShortName( uniset_conf()->oind->getMapName(
<xsl:value-of
select=
"@name"
/>
))
<<
")";
s
<<
"="
<<
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
;
return s
.str(
);
return s
td::move(s.str()
);
}
</xsl:for-each>
return "";
...
...
@@ -1319,14 +1333,28 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
ostringstream s;
s
<<
myname
<<
": "
<<
endl;
ostringstream s1;
vector
<
std::string
>
v;
<xsl:for-each
select=
"//sensors/item/consumers/consumer"
>
<xsl:if
test=
"normalize-space(../../@msg)!='1'"
>
<xsl:if
test=
"normalize-space(@name)=$OID"
>
s
<<
" "
<<
strval(
<xsl:value-of
select=
"../../@name"
/>
)
<<
endl;
s1.str("");
s1
<<
" "
<<
strval(
<xsl:value-of
select=
"../../@name"
/>
);
v.push_back(s1.str());
</xsl:if>
</xsl:if>
</xsl:for-each>
return s.str();
int n=0;
for( const auto
&
e: v )
{
s
<<
e;
if( (++n)%2 )
s
<<
endl;
}
return std::move(s.str());
}
// ----------------------------------------------------------------------------
std::string
<xsl:value-of
select=
"$CLASSNAME"
/>
_SK::str( UniSetTypes::ObjectId id, bool showLinkName )
...
...
@@ -1339,7 +1367,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::str( UniSetTypes::ObjectId
{
s
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
";
if( showLinkName ) s
<<
"(
<xsl:value-of
select=
"../../@name"
/>
)";
return s
.str(
);
return s
td::move(s.str()
);
}
</xsl:if>
</xsl:if>
...
...
@@ -1358,7 +1386,7 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::strval( UniSetTypes::Object
s
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
";
if( showLinkName ) s
<<
"(
<xsl:value-of
select=
"../../@name"
/>
)";
s
<<
"="
<<
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"../../@name"
/>
;
return s
.str(
);
return s
td::move(s.str()
);
}
</xsl:if>
</xsl:if>
...
...
conf/libuniset2.spec
View file @
f252f537
...
...
@@ -13,7 +13,7 @@
Name: libuniset2
Version: 2.1
Release: alt8
Release: alt8
.1
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -456,6 +456,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
# ..
%changelog
* Sun Jun 28 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt8.1
- VMonitor: added output information in the form of two columns
* Sat Jun 20 2015 Pavel Vainerman <pv@altlinux.ru> 2.1-alt8
- release
...
...
extensions/tests/SMemoryTest/TestProc.cc
View file @
f252f537
...
...
@@ -19,6 +19,7 @@ TestProc::TestProc( UniSetTypes::ObjectId id, xmlNode* confnode ):
lit
=
loglevels
.
begin
();
out_log_c
=
(
*
lit
);
vmonit
(
undef
);
}
// -----------------------------------------------------------------------------
TestProc
::~
TestProc
()
...
...
@@ -34,7 +35,6 @@ TestProc::TestProc():
// -----------------------------------------------------------------------------
void
TestProc
::
step
()
{
snap
(
undef
);
}
// -----------------------------------------------------------------------------
void
TestProc
::
sysCommand
(
const
UniSetTypes
::
SystemMessage
*
sm
)
...
...
include/Debug.h
View file @
f252f537
...
...
@@ -85,7 +85,7 @@ struct Debug
/** A function to convert symbolic string names on debug levels
to their numerical value.
*/
static
Debug
::
type
value
(
string
const
&
val
);
static
Debug
::
type
value
(
st
d
::
st
ring
const
&
val
);
/** Display the tags and descriptions of the current debug level
of ds
...
...
include/VMonitor.h
View file @
f252f537
...
...
@@ -118,6 +118,7 @@ class VMonitor
friend
std
::
ostream
&
operator
<<
(
std
::
ostream
&
os
,
VMonitor
&
m
);
static
const
int
NameWidth
=
{
30
};
static
const
int
ColCount
=
{
2
};
std
::
string
str
();
std
::
string
pretty_str
();
...
...
src/Various/VMonitor.cc
View file @
f252f537
// --------------------------------------------------------------------------
#include <string>
#include <sstream>
#include <vector>
#include <iomanip>
#include "VMonitor.h"
// --------------------------------------------------------------------------
...
...
@@ -91,26 +92,76 @@
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET(T) \
{\
std::vector<std::string> v(m_char.size()+m_unsigned_char.size());\
std::ostringstream s;\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
{\
s.str("");\
s << pretty_str(e.second,e.first);\
v.push_back(s.str()); \
}\
\
int n = 0;\
for( const auto& e: v ) \
{\
os << e; \
if( (n++)%ColCount ) \
os << std::endl; \
} \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET2(T) \
{\
std::vector<std::string> v(m_char.size()+m_unsigned_char.size());\
std::ostringstream s;\
for( const auto& e: m_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
{\
s.str("");\
s << pretty_str(e.second,e.first);\
v.push_back(s.str());\
}\
\
for( const auto& e: m_unsigned_##T ) \
os << pretty_str(e.second,e.first) << std::endl;\
{\
s.str("");\
s << pretty_str(e.second,e.first);\
v.push_back(s.str());\
}\
\
int n = 0;\
for( const auto& e: v ) \
{\
os << e; \
if( (n++)%ColCount ) \
os << std::endl; \
} \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET_CHAR \
{\
std::vector<std::string> v(m_char.size()+m_unsigned_char.size());\
std::ostringstream s;\
for( const auto& e: m_char ) \
os << std::right << std::setw(NameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
{\
s.str("");\
s << std::right << std::setw(NameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first));\
v.push_back(s.str());\
}\
\
for( const auto& e: m_unsigned_char ) \
os << std::right << std::setw(NameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
{\
s.str("");\
s << std::right << std::setw(NameWidth) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first));\
v.push_back(s.str()); \
}\
\
int n = 0;\
for( const auto& e: v ) \
{\
os << e; \
if( (n++)%ColCount ) \
os << std::endl; \
} \
}
// --------------------------------------------------------------------------
VMON_IMPL_ADD2
(
int
)
...
...
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