Hybrid Query Processing Engine for Coprocessing in Database Systems
HyPE
hype.cpp
Go to the documentation of this file.
00001 /***********************************************************************************************************
00002 Copyright (c) 2012, Sebastian Breß, Otto-von-Guericke University of Magdeburg, Germany. All rights reserved.
00003 
00004 This program and accompanying materials are made available under the terms of the 
00005 GNU LESSER GENERAL PUBLIC LICENSE - Version 3, http://www.gnu.org/licenses/lgpl-3.0.txt
00006 ***********************************************************************************************************/
00007 #include <hype.hpp>
00008 #include <core/scheduler.hpp>
00009 #include <core/algorithm_measurement.hpp>
00010 #include <core/time_measurement.hpp>
00011 #include <core/workload_generator.hpp>
00012 #include <core/statistics_gatherer.hpp>
00013 #include <config/global_definitions.hpp>
00014 
00015 //#include <boost/thread.hpp>
00016 
00017 namespace hype{
00018    
00019       //boost::mutex global_mutex;
00020 
00021       Scheduler& Scheduler::instance(){
00022          static Scheduler scheduler;
00023          //return core::Scheduler::instance();
00024          return scheduler;
00025       }
00026          
00027 //    bool Scheduler::addAlgorithm(const std::string& name_of_operation, 
00028 //                            const std::string& name_of_algorithm,
00029 //                            ComputeDevice comp_dev, 
00030 //                            const std::string& name_of_statistical_method, 
00031 //                            const std::string& name_of_recomputation_strategy)
00032 //    {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00033 //       return core::Scheduler::instance().addAlgorithm(name_of_operation,name_of_algorithm,comp_dev,name_of_statistical_method,name_of_recomputation_strategy);
00034 //    }
00035       
00036       bool Scheduler::addAlgorithm(const AlgorithmSpecification& alg_spec, const DeviceSpecification& dev_spec)      {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00037          return core::Scheduler::instance().addAlgorithm(alg_spec, dev_spec);
00038       }
00039       
00040    
00041       bool Scheduler::setOptimizationCriterion(const std::string& name_of_operation,
00042                                           const std::string& name_of_optimization_criterion)
00043       {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00044          return core::Scheduler::instance().setOptimizationCriterion(name_of_operation,name_of_optimization_criterion);
00045       }
00046 
00047       bool Scheduler::setStatisticalMethod(const std::string& name_of_algorithm,
00048                                       const std::string& name_of_statistical_method)
00049       {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00050          return core::Scheduler::instance().setStatisticalMethod(name_of_algorithm,name_of_statistical_method);
00051       }
00052       
00053       bool Scheduler::setRecomputationHeuristic(const std::string& name_of_algorithm,
00054                                            const std::string& name_of_recomputation_strategy)      
00055       {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00056          return core::Scheduler::instance().setRecomputationHeuristic(name_of_algorithm,name_of_recomputation_strategy);
00057       }
00058          
00059 
00060 //    const SchedulingDecision Scheduler::getOptimalAlgorithmName(const std::string& name_of_operation, const Tuple& input_values, DeviceTypeConstraint dev_constr)     
00061 //    {  //boost::lock_guard<boost::mutex> lock(global_mutex);
00062 //       return core::Scheduler::instance().getOptimalAlgorithmName(name_of_operation,input_values,dev_constr);
00063 //    }
00064 
00065       const SchedulingDecision Scheduler::getOptimalAlgorithm(const OperatorSpecification& op_spec, const DeviceConstraint& dev_constr){
00066          return core::Scheduler::instance().getOptimalAlgorithm(op_spec,dev_constr);
00067       }
00068       
00069       /*
00070       bool Scheduler::addObservation(const std::string& name_of_algorithm, const MeasurementPair& mp)
00071       {
00072          return core::Scheduler::instance().addObservation(name_of_algorithm,mp);            
00073       }*/
00074 
00075       bool Scheduler::addObservation(const SchedulingDecision& sched_dec, const double& measured_execution_time){
00076 //       return core::Scheduler::instance().addObservation(sched_dec.getNameofChoosenAlgorithm(),
00077 //                                                         core::MeasurementPair(sched_dec.getFeatureValues(),
00078 //                                                                               core::MeasuredTime(measured_execution_time),
00079 //                                                                               sched_dec.getEstimatedExecutionTimeforAlgorithm()
00080 //                                                                               )
00081          return core::Scheduler::instance().addObservation(sched_dec,measured_execution_time);
00082       }
00083 
00084       hype::core::EstimatedTime Scheduler::getEstimatedExecutionTime(const OperatorSpecification& op_spec, const std::string& alg_name){
00085          return core::Scheduler::instance().getEstimatedExecutionTime(op_spec, alg_name);
00086       }
00087 
00088       Scheduler::Scheduler(){}
00089             
00090       Scheduler::Scheduler(const Scheduler&){}
00091 
00092 }; //end namespace hype
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines