Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cta
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dCache
cta
Commits
fff43b6d
Commit
fff43b6d
authored
13 years ago
by
Andrea Ieri
Browse files
Options
Downloads
Patches
Plain Diff
Changes for ns security performance testing.
parent
ba0e7380
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
test/ns/Imakefile
+0
-3
0 additions, 3 deletions
test/ns/Imakefile
test/ns/TestMTServer.cpp
+7
-3
7 additions, 3 deletions
test/ns/TestMTServer.cpp
test/ns/TestThread.cpp
+41
-9
41 additions, 9 deletions
test/ns/TestThread.cpp
test/ns/TestThread.hpp
+1
-1
1 addition, 1 deletion
test/ns/TestThread.hpp
with
49 additions
and
16 deletions
test/ns/Imakefile
+
0
−
3
View file @
fff43b6d
...
...
@@ -5,12 +5,9 @@ COMM
COMM Make CASTOR tests for "ns" directory
CPPFLAGS += $(ORACLE_CPPFLAGS)
AddLdFlags(-L$(ORACLE_LIBDIR) -locci -lclntsh)
DependsOnLibrary(common,castorcommon)
DependsOnLibrary(castor,castorclient)
DependsOnLibrary(castor/db/cnv,castorcnvs)
DependsOnLibrary(castor/db/newora,castorcommonora)
NSTESTSRCS = TestThread.cpp \
TestMTServer.cpp
...
...
This diff is collapsed.
Click to expand it.
test/ns/TestMTServer.cpp
+
7
−
3
View file @
fff43b6d
...
...
@@ -29,7 +29,7 @@
#include
"castor/exception/Exception.hpp"
#include
"castor/BaseObject.hpp"
#include
"castor/Services.hpp"
#include
"castor/db/DbParamsSvc.hpp"
//
#include "castor/db/DbParamsSvc.hpp"
#include
"castor/dlf/Dlf.hpp"
#include
"castor/server/SignalThreadPool.hpp"
...
...
@@ -47,6 +47,7 @@ int main(int argc, char *argv[]) {
// Create a db parameters service and fill with appropriate defaults
// (only needed when direct access to the NS database is required)
/*
castor::IService* s = castor::BaseObject::sharedServices()->service("DbParamsSvc", castor::SVC_DBPARAMSSVC);
castor::db::DbParamsSvc* params = dynamic_cast<castor::db::DbParamsSvc*>(s);
if(params == 0) {
...
...
@@ -56,7 +57,10 @@ int main(int argc, char *argv[]) {
}
params->setSchemaVersion("2_1_9_0");
params->setDbAccessConfFile("/etc/castor/ORANSCONFIG");
*/
//server.addThreadPool(
// new castor::server::SignalThreadPool("Test", new TestCnsStatThread(), 10, 20, 300));
// Create a standard thread pool for the testing code.
// XXX The last argument is a hack to make all threads start immediately as opposed
// to the default behavior of Castor daemons whereby only one thread starts
...
...
@@ -87,7 +91,7 @@ TestMTServer::TestMTServer() :
castor
::
server
::
BaseDaemon
(
"MTTest"
)
{
// Initializes the DLF logging
castor
::
dlf
::
Message
nomsgs
[
1
];
castor
::
dlf
::
Message
nomsgs
[]
=
{{
-
1
,
""
}}
;
dlfInit
(
nomsgs
);
}
...
...
This diff is collapsed.
Click to expand it.
test/ns/TestThread.cpp
+
41
−
9
View file @
fff43b6d
...
...
@@ -39,13 +39,16 @@
#include
"TestThread.hpp"
#include
"castor/server/SignalThreadPool.hpp"
#include
<vector>
//------------------------------------------------------------------------------
// constructor
//------------------------------------------------------------------------------
TestThread
::
TestThread
()
:
m_procTime
(
0
),
m_wallTime
(
0
),
m_reqCount
(
0
),
m_nbThreads
(
0
)
{
m_procTime
(
0
),
m_wallTime
(
0
),
m_reqCount
(
0
),
m_timeStdDev
(
0
),
m_nbThreads
(
0
)
{
m
=
new
castor
::
server
::
Mutex
(
0
);
m_timeStart
.
tv_usec
=
0
;
srand
((
unsigned
)
time
(
NULL
));
}
...
...
@@ -54,21 +57,44 @@ TestThread::TestThread() :
//------------------------------------------------------------------------------
void
TestThread
::
run
(
void
*
param
)
{
//u_signed64 i = 0;
char
server
[]
=
"lxc2dev2"
;
// for nsping
char
buf
[
10
];
u_signed64
c
=
0
;
u_signed64
reqProcTime
=
0
,
timeStdDev
=
0
;
//struct Cns_filestat cnsFilestat;
castor
::
server
::
SignalThreadPool
*
p
=
(
castor
::
server
::
SignalThreadPool
*
)
param
;
// For testing Cns_getpath
//char server[] = "lxc2dev2"; // for nsping
//char buf[10000];
//std::vector<u_signed64> validids;
//std::ifstream id_ifs("validids.txt");
//std::string id;
//while(getline(id_ifs, id)){
// validids.push_back(atoi(id.c_str()));
//}
//unsigned validids_len = validids.size();
// For testing Cns_stat
std
::
vector
<
std
::
string
>
validpaths
;
validpaths
.
reserve
(
230909
);
std
::
ifstream
paths_ifs
(
"validpaths.txt"
);
std
::
string
path
;
Cns_filestat
statbuf
;
while
(
getline
(
paths_ifs
,
path
)){
validpaths
.
push_back
(
path
);
}
unsigned
validpaths_len
=
validpaths
.
size
();
castor
::
server
::
SignalThreadPool
*
p
=
(
castor
::
server
::
SignalThreadPool
*
)
param
;
if
(
!
m_timeStart
.
tv_usec
)
{
// hopefully only one thread computes it
m_timeStart
.
tv_usec
=
1
;
gettimeofday
(
&
m_timeStart
,
0
);
}
timeval
reqStart
,
reqEnd
;
while
(
!
p
->
stopped
())
{
//i = rand() % maxNb;
...
...
@@ -78,10 +104,14 @@ void TestThread::run(void* param) {
gettimeofday
(
&
reqStart
,
0
);
// *** Do something here ***
Cns_ping
(
server
,
buf
);
//Cns_ping(server, buf);
//Cns_getpath(server, validids[rand() % validids_len], buf);
Cns_stat
(
validpaths
[
rand
()
%
validpaths_len
].
c_str
(),
&
statbuf
);
//Cns_statx(m_files[i].c_str(), &cnsFileid, &cnsFilestat);
// collect statistics
// collect statistics
gettimeofday
(
&
reqEnd
,
0
);
c
++
;
u_signed64
t
=
((
reqEnd
.
tv_sec
*
1000000
)
+
reqEnd
.
tv_usec
)
-
((
reqStart
.
tv_sec
*
1000000
)
+
reqStart
.
tv_usec
);
...
...
@@ -93,7 +123,7 @@ void TestThread::run(void* param) {
std
::
cout
<<
"Thread #"
<<
syscall
(
__NR_gettid
)
<<
" : req.count = "
<<
c
<<
" avgProcTime = "
<<
reqProcTime
*
0.000001
/
c
<<
" sec +/- "
<<
0.000001
*
(
c
-
1
)
/
c
*
sqrt
(
timeStdDev
*
1.0
/
c
-
(
reqProcTime
*
1.0
/
c
)
*
(
reqProcTime
*
1.0
/
c
))
<<
" sec"
<<
std
::
endl
;
if
(
!
m_wallTime
)
{
// hopefully only one thread computes it
m_wallTime
=
1
;
...
...
@@ -106,6 +136,7 @@ void TestThread::run(void* param) {
m
->
lock
();
m_reqCount
+=
c
;
m_nbThreads
++
;
m_timeStdDev
+=
timeStdDev
;
m_procTime
+=
reqProcTime
;
m
->
release
();
...
...
@@ -114,6 +145,7 @@ void TestThread::run(void* param) {
std
::
cout
.
precision
(
4
);
std
::
cout
<<
"Total req.count = "
<<
m_reqCount
<<
" wallTime = "
<<
m_wallTime
*
0.000001
<<
" sec avgProcTime = "
<<
m_procTime
*
0.000001
/
m_reqCount
<<
" sec +/- "
<<
0.000001
*
m_reqCount
/
m_reqCount
*
sqrt
(
m_timeStdDev
*
1.0
/
m_reqCount
-
pow
(
m_procTime
*
1.0
/
m_reqCount
,
2
))
<<
" sec p/wTime = "
<<
m_procTime
/
m_wallTime
<<
" throughput = "
<<
m_reqCount
*
1000000.0
/
m_wallTime
<<
" req/sec"
<<
std
::
endl
;
}
...
...
This diff is collapsed.
Click to expand it.
test/ns/TestThread.hpp
+
1
−
1
View file @
fff43b6d
...
...
@@ -45,7 +45,7 @@ class TestThread : public castor::server::IThread {
~
TestThread
()
throw
()
{};
private
:
u_signed64
m_procTime
,
m_wallTime
,
m_reqCount
;
u_signed64
m_procTime
,
m_wallTime
,
m_reqCount
,
m_timeStdDev
;
timeval
m_timeStart
;
unsigned
m_nbThreads
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment