Commit 9e8fdc8e authored by Anjo Vahldiek's avatar Anjo Vahldiek
Browse files

added lab4

parent d3b6f477
LAB=3
LAB=4
SOL=0
RPC=./rpc
LAB2GE=$(shell expr $(LAB) \>\= 2)
......@@ -32,7 +32,7 @@ LDLIBS += $(shell test -f `gcc -print-file-name=libdl.so` && echo -ldl)
CC = g++
CXX = g++
lab: lab3
lab: lab4
lab1: rpc/rpctest lock_server lock_tester lock_demo
lab2: yfs_client extent_server
lab3: yfs_client extent_server
......@@ -134,14 +134,14 @@ l3-sol:
stop.sh test-lab-2.pl mkfs.sh $(hfiles2) $(hfiles1) test-lab-3.pl
l4:
./mklab.pl 4 0 l4 GNUmakefile test-lab-4-a.pl $(rpclib) $(yfs_client)\
./mklab.pl 4 0 l4 GNUmakefile test-lab-4-a.pl $(rpclib) $(yfs_client) $(rpctest) $(lock_server)\
$(extent_server) start.sh stop.sh test-lab-2.pl mkfs.sh\
$(hfiles2) $(test-lab-4-b) $(test-lab-4-c)
$(lock_demo) $(lock_tester) $(hfiles1) $(hfiles2) $(test-lab-4-b) $(test-lab-4-c)
l4-sol:
./mklab.pl 4 4 l4-sol GNUmakefile test-lab-4-a.pl $(yfs_client) $(rpclib) $(rpctest) $(lock_server)\
$(extent_server) start.sh stop.sh test-lab-2.pl mkfs.sh\
$(lock_demo) $(lock_tester) $(hfiles1) $(hfiles2) $(test-lab-4-b) $(test-lab-4-c)
$(lock_demo) $(lock_tester) $(hfiles1) $(hfiles2) $(test-lab-4-b) $(test-lab-4-c)
l5:
./mklab.pl 5 0 l5 GNUmakefile test-lab-4-a.pl $(rpclib) $(yfs_client)\
......
......@@ -11,6 +11,8 @@
int
main(int argc, char *argv[])
{
int count = 0;
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
......@@ -21,15 +23,19 @@ main(int argc, char *argv[])
exit(1);
}
char *count_env = getenv("RPC_COUNT");
if(count_env != NULL){
count = atoi(count_env);
}
//jsl_set_debug(2);
#ifndef RSM
lock_server ls;
rpcs server(atoi(argv[1]));
rpcs server(atoi(argv[1]), count);
server.reg(lock_protocol::stat, &ls, &lock_server::stat);
#endif
while(1)
sleep(1000);
}
......@@ -400,9 +400,12 @@ rpcs::updatestat(unsigned int proc)
curr_counts_--;
if(curr_counts_ == 0) {
std::map<int, int>::iterator i;
printf("RPC STATS: ");
for (i = counts_.begin(); i != counts_.end(); i++) {
jsl_log(JSL_DBG_1, "RPC STATS: %x %d\n", i->first, i->second);
printf("%x %d ", i->first, i->second);
}
printf("\n");
ScopedLock rwl(&reply_window_m_);
std::map<unsigned int,std::list<reply_t> >::iterator clt;
......@@ -412,7 +415,7 @@ rpcs::updatestat(unsigned int proc)
if (clt->second.size() > maxrep)
maxrep = clt->second.size();
}
jsl_log(JSL_DBG_1, "REPLY WINDOW: clients %ld total reply %d max per client %d\n",
jsl_log(JSL_DBG_1, "REPLY WINDOW: clients %d total reply %d max per client %d\n",
reply_window_.size(), totalrep, maxrep);
curr_counts_ = counting_;
}
......@@ -687,15 +690,6 @@ operator<<(marshall &m, unsigned long long x)
return m;
}
marshall &
operator<<(marshall &m, unsigned long x)
{
if(sizeof(unsigned long) == sizeof(unsigned int))
return m << (unsigned int)x;
if(sizeof(unsigned long) == sizeof(unsigned long long))
return m << (unsigned long long) x;
}
void
marshall::pack(int x)
{
......@@ -807,15 +801,6 @@ operator>>(unmarshall &u, unsigned long long &x)
return u;
}
unmarshall &
operator>>(unmarshall &u, unsigned long &x)
{
if(sizeof(unsigned long) == sizeof(unsigned int))
return u >> (unsigned int &) x;
if(sizeof(unsigned long) == sizeof(unsigned long long))
return u >> (unsigned long long &) x;
}
unmarshall &
operator>>(unmarshall &u, std::string &s)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment