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
cf0e63e3
Commit
cf0e63e3
authored
Jun 08, 2015
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(VMonitor): добавил вспомогательные функции pretty_str(...) чтобы
можно было вызывать "снаружи". (uniset2-vmonit): добавил команду -d |--dump - распечатать состояние и выйти
parent
b9666421
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
12 deletions
+50
-12
uniset2-vmonit
Utilities/Admin/uniset2-vmonit
+6
-3
ctl-cpp-common.xsl
Utilities/codegen/ctl-cpp-common.xsl
+2
-2
VMonitor.h
include/VMonitor.h
+12
-2
VMonitor.cc
src/Various/VMonitor.cc
+30
-5
No files found.
Utilities/Admin/uniset2-vmonit
View file @
cf0e63e3
...
...
@@ -14,7 +14,8 @@ print_usage()
{
[
"
$1
"
=
0
]
||
exec
>
&2
echo
"Usage:
${
0
##*/
}
[-s watch_sec] ObjectID1[@node],ObjectID2,.."
echo
"Usage:
${
0
##*/
}
[-s watch_sec | -d] ObjectID1[@node],ObjectID2,.."
echo
" -d - dump state. Print state and exit"
# echo ""
# uniset2-admin --help
...
...
@@ -25,12 +26,15 @@ print_usage()
[
-z
"
$1
"
]
&&
print_usage 1
#parse command line options
dump
=
case
"
$1
"
in
-h
|
--help
)
print_usage 0
;;
-s
|
--sec
)
shift
;
WATCH_SEC
=
$1
;
shift
;;
-d
|
--dump
)
dump
=
1
;
shift
;;
esac
OID
=
$1
shift
$WATCH
-n
$WATCH_SEC
uniset2-admin
--oinfo
${
OID
}
$*
\ No newline at end of file
[
-z
"
$dump
"
]
&&
$WATCH
-n
$WATCH_SEC
uniset2-admin
--oinfo
${
OID
}
$*
[
-n
"
$dump
"
]
&&
uniset2-admin
--oinfo
${
OID
}
$*
Utilities/codegen/ctl-cpp-common.xsl
View file @
cf0e63e3
...
...
@@ -1021,8 +1021,8 @@ std::string <xsl:value-of select="$CLASSNAME"/>_SK::dumpIO()
ostringstream s;
s
<<
myname
<<
": "
<<
endl;
<xsl:for-each
select=
"//smap/item"
>
s
<<
" "
<<
setw(
2
0)
<<
std::right
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
"
<<
"("
<<
setw(
2
0)
<<
std::left
<<
ORepHelpers::getShortName( uniset_conf()->oind->getMapName(
<xsl:value-of
select=
"@name"
/>
))
<<
")"
s
<<
" "
<<
setw(
3
0)
<<
std::right
<<
"
<xsl:call-template
name=
"setprefix"
/><xsl:value-of
select=
"@name"
/>
"
<<
"("
<<
setw(
3
0)
<<
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;
</xsl:for-each>
...
...
include/VMonitor.h
View file @
cf0e63e3
...
...
@@ -29,12 +29,16 @@
#include "UniSetTypes.h"
// --------------------------------------------------------------------------
#ifndef VMON_DEF_FUNC
#define VMON_DEF_FUNC(T) void add( const std::string& name, const T& v )
#define VMON_DEF_FUNC(T) \
void add( const std::string& name, const T& v );\
const std::string pretty_str( const std::string& name, const T* v )
#endif
#ifndef VMON_DEF_FUNC2
#define VMON_DEF_FUNC2(T) \
void add( const std::string& name, const T& v );\
void add( const std::string& name, const unsigned T& v )
void add( const std::string& name, const unsigned T& v );\
const std::string pretty_str( const std::string& name, const T* v );\
const std::string pretty_str( const std::string& name, const unsigned T* v )
#endif
#ifndef VMON_DEF_MAP
...
...
@@ -124,6 +128,10 @@ class VMonitor
// VMON_DEF_FUNC(UniSetTypes::ObjectId); // <--- long
void
add
(
const
std
::
string
&
name
,
const
std
::
string
&
v
);
const
std
::
string
pretty_str
(
const
std
::
string
&
name
,
const
std
::
string
*
v
);
inline
int
getNameWidth
(){
return
nameWidth
;
}
inline
void
setNameWidth
(
int
w
){
nameWidth
=
w
;
}
protected
:
...
...
@@ -138,6 +146,8 @@ class VMonitor
VMON_DEF_MAP
(
double
);
// VMON_DEF_MAP3(UniSetTypes::ObjectId,ObjectId); // <-- long
VMON_DEF_MAP3
(
std
::
string
,
string
);
int
nameWidth
=
{
30
};
};
// --------------------------------------------------------------------------
#endif
src/Various/VMonitor.cc
View file @
cf0e63e3
...
...
@@ -7,6 +7,13 @@
#define VMON_IMPL_ADD(T) void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##T.emplace(&v,name); \
} \
\
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_ADD2(T) \
...
...
@@ -17,11 +24,29 @@ void VMonitor::add( const std::string& name, const T& v ) \
void VMonitor::add( const std::string& name, const unsigned T& v ) \
{\
m_unsigned_##T.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const unsigned T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_ADD3(T,M) void VMonitor::add( const std::string& name, const T& v ) \
{\
m_##M.emplace(&v,name); \
} \
const std::string VMonitor::pretty_str( const std::string& name, const T* v ) \
{ \
std::ostringstream s; \
s << std::right << std::setw(nameWidth) << name << std::left << " = " << std::right << std::setw(6) << *(v); \
return std::move(s.str()); \
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRN(M,T) \
...
...
@@ -51,25 +76,25 @@ void VMonitor::add( const std::string& name, const unsigned T& v ) \
#define VMON_IMPL_PRET(T) \
{\
for( const auto& e: m_##T ) \
os <<
std::right << std::setw(25) << e.second << std::left << " = " << std::right << std::setw(6) << *(
e.first) << std::endl;\
os <<
pretty_str(e.second,
e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET2(T) \
{\
for( const auto& e: m_##T ) \
os <<
std::right << std::setw(25) << e.second << std::left << " = " << std::right << std::setw(6) << *(
e.first) << std::endl;\
os <<
pretty_str(e.second,
e.first) << std::endl;\
\
for( const auto& e: m_unsigned_##T ) \
os <<
std::right << std::setw(25) << e.second << std::left << " = " << std::right << std::setw(6) << *(
e.first) << std::endl;\
os <<
pretty_str(e.second,
e.first) << std::endl;\
}
// --------------------------------------------------------------------------
#define VMON_IMPL_PRET_CHAR \
{\
for( const auto& e: m_char ) \
os << std::right << std::setw(
25
) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
os << std::right << std::setw(
nameWidth
) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
\
for( const auto& e: m_unsigned_char ) \
os << std::right << std::setw(
25
) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << std::endl;\
os << std::right << std::setw(
nameWidth
) << e.second << std::left << " = " << std::right << std::setw(6) << (int)(*(e.first)) << 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