Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
processing_device.hpp
Go to the documentation of this file.
00001 
00002 #pragma once
00003 
00004 #include <list>
00005 
00006 #include <config/global_definitions.hpp>
00007 
00008 #include <query_processing/operator.hpp>
00009 
00010 
00011 //g++ compiler workaround for boost thread!
00012 #ifdef __GNUC__
00013 #pragma GCC visibility push(default)
00014 #endif
00015 #include <boost/thread.hpp>
00016 #include <boost/bind.hpp>
00017 //g++ compiler workaround for boost thread!
00018 #ifdef __GNUC__
00019 #pragma GCC visibility pop
00020 #endif
00021 
00022 namespace hype
00023 {
00024    namespace queryprocessing
00025    {
00026 
00027       class ProcessingDevice
00028       {
00029 
00030          public:
00031             ProcessingDevice();
00032 
00033             bool addOperator(OperatorPtr op);
00034 
00035             void start();
00036             void stop();
00037             void run(); //thread
00038             bool isIdle();
00041             double getEstimatedTimeUntilIdle();
00042             double getTotalProcessingTime();
00043          private:
00044             ProcessingDevice(const ProcessingDevice& pd);
00045             ProcessingDevice& operator=(const ProcessingDevice&);
00047             double getEstimatedTimeUntilOperatorCompletion();
00048 
00049             typedef std::list<OperatorPtr> OperatorList;
00050             OperatorList operators_;
00051             boost::condition_variable new_operator_available_;
00052             boost::condition_variable operator_queue_full_;       
00053             boost::mutex operator_mutex_;
00054             boost::thread thread_;
00055             uint64_t start_timestamp_of_currently_executed_operator_;
00056             double estimated_execution_time_of_currently_executed_operator_;
00057             bool operator_in_execution_;
00058             double estimated_execution_time_for_operators_in_queue_to_complete_;
00059             double total_measured_execution_time_for_all_executed_operators_; //used to determine how processing devices were utilized
00060       };
00062       ProcessingDevice& getProcessingDevice(const hype::core::DeviceSpecification& dev); //can later be queried by using algorithmptr->getDeviceSpecification();
00063 
00064 
00065 
00066    }; //end namespace queryprocessing
00067 }; //end namespace hype
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines