GreenCloud Simulator
Public Member Functions | Protected Attributes | List of all members
TskOutSink Class Reference

#include <tskoutsink.h>

Inheritance diagram for TskOutSink:
Inheritance graph
[legend]
Collaboration diagram for TskOutSink:
Collaboration graph
[legend]

Public Member Functions

 TskOutSink ()
 
virtual ~TskOutSink ()
 
void addResourceProvider (ResourceProvider *newrp)
 
virtual int command (int argc, const char *const *argv)
 
virtual void recv (Packet *pkt, Handler *)
 
- Public Member Functions inherited from ByteCounter
 ByteCounter ()
 
virtual ~ByteCounter ()
 
int resetBytesSince ()
 
double getLastBytesSinceTime ()
 

Protected Attributes

int nlost_
 
int npkts_
 
int expected_
 
int bytes_
 
int seqno_
 
double last_packet_time_
 
ProviderOutAgentpoa_
 
ResourceProviderres_provider_
 
- Protected Attributes inherited from ByteCounter
int bytes_since_
 
double last_bytes_since_
 

Detailed Description

Definition at line 20 of file tskoutsink.h.

Constructor & Destructor Documentation

TskOutSink::TskOutSink ( )

Definition at line 30 of file tskoutsink.cc.

30  : TcpSink(new Acker()), poa_(NULL)
31 {
32 
33 }
ProviderOutAgent * poa_
Definition: tskoutsink.h:35
TskOutSink::~TskOutSink ( )
virtual

Definition at line 35 of file tskoutsink.cc.

36 {
37  res_provider_ = NULL;
38 }
ResourceProvider * res_provider_
Definition: tskoutsink.h:37

Member Function Documentation

void TskOutSink::addResourceProvider ( ResourceProvider newrp)
int TskOutSink::command ( int  argc,
const char *const *  argv 
)
virtual

Definition at line 54 of file tskoutsink.cc.

55 {
56  if (argc == 2) {
57  if (strcmp(argv[1], "clear") == 0) {
58  expected_ = -1;
59  return (TCL_OK);
60  }
61  }
62  if (argc == 3) {
63  if (strcmp(argv[1], "connect-tskoutagent") == 0) {
64  ProviderOutAgent *poa =(ProviderOutAgent*)(TclObject::lookup(argv[2]));
65  if(poa){
66  poa_ = poa;
67  return (TCL_OK);
68  }
69  return (TCL_ERROR);
70  }
71  }
72 
73  return (Agent::command(argc, argv));
74 }
ProviderOutAgent * poa_
Definition: tskoutsink.h:35
int expected_
Definition: tskoutsink.h:31
void TskOutSink::recv ( Packet *  pkt,
Handler *  h 
)
virtual

Definition at line 40 of file tskoutsink.cc.

41 {
42  /* Get TskObject and start its execution */
43  CloudTask *recvTskObj = (CloudTask*)hdr_cmn::access(pkt)->pt_obj_addr();
44  if (recvTskObj) { /* Valid pointer and can be executed */
45 // std::cout << "Task id:" << recvTskObj->id_ << "exits the DC at: "<< Scheduler::instance().clock() <<"\n";
46  recvTskObj->info_->finalizeDcExitTime(Scheduler::instance().clock());
47  poa_->tryToSend();
49  }
50  TcpSink::recv(pkt,h);
51 }
TaskInfo * info_
Definition: cloudtask.h:61
ProviderOutAgent * poa_
Definition: tskoutsink.h:35
void finalizeDcExitTime(double time)
Definition: taskinfo.cc:45
virtual void updateEnergyAndConsumption()
Definition: dchost.cc:138
ResourceProvider * getResourceProvider()
Definition: taskinfo.cc:49

Member Data Documentation

int TskOutSink::bytes_
protected

Definition at line 32 of file tskoutsink.h.

int TskOutSink::expected_
protected

Definition at line 31 of file tskoutsink.h.

double TskOutSink::last_packet_time_
protected

Definition at line 34 of file tskoutsink.h.

int TskOutSink::nlost_
protected

Definition at line 29 of file tskoutsink.h.

int TskOutSink::npkts_
protected

Definition at line 30 of file tskoutsink.h.

ProviderOutAgent* TskOutSink::poa_
protected

Definition at line 35 of file tskoutsink.h.

ResourceProvider* TskOutSink::res_provider_
protected

Definition at line 37 of file tskoutsink.h.

int TskOutSink::seqno_
protected

Definition at line 33 of file tskoutsink.h.


The documentation for this class was generated from the following files: