当前位置: 首页>>代码示例>>PHP>>正文


PHP Scheduler::schedule方法代码示例

本文整理汇总了PHP中Scheduler::schedule方法的典型用法代码示例。如果您正苦于以下问题:PHP Scheduler::schedule方法的具体用法?PHP Scheduler::schedule怎么用?PHP Scheduler::schedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Scheduler的用法示例。


在下文中一共展示了Scheduler::schedule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: scheduleMessage

 public function scheduleMessage($to, $txt, $date)
 {
     $scheduler = new Scheduler($this->user, $this->token);
     $scheduleId = $scheduler->schedule($to, $txt, $date);
     return $scheduleId;
 }
开发者ID:andresilvagomez,项目名称:elibom,代码行数:6,代码来源:ElibomClient.php

示例2: simple_time

    Hatcheries::$debug = (bool) ($debugFlags & Hatcheries::debugFlag);
    $timeline->hatcheries->add(new Hatchery(0, 3));
    $timeline->farms->add(new Farm(0, $Hatchery->supplyCapacity));
    $timeline->farms->add(new Farm(0, $Overlord->supplyCapacity));
    //$timeline->queues->add(new ProductionQueue($Hatchery));
}
$timeline->queues->add(new ProductionQueue(Product::designated($race | Base)));
$timeline->supplyCount = 6;
// create recurring worker job
$job = new BuildJob(Product::designated($race | Worker));
$job->recurring = true;
$unscheduledJobs[] = $job;
// schedule jobs
$scheduler = new Scheduler($timeline, $unscheduledJobs);
Scheduler::$debug = (bool) ($debugFlags & Scheduler::debugFlag);
$scheduledJobs = $scheduler->schedule();
// render timeline
echo (string) $timeline;
// render queues
$timeEnds = 0;
foreach ($scheduledJobs as $job) {
    $timeEnds = max($timeEnds, $job->timeCompleted);
}
?>
<h3>Usage of production queues</h3>
<p>This table shows the busy time of your production queues. Production queues which remain completely unused are not shown. A production queue is considered <i>destroyed</i> when the structure is morphed into another structure, such as a Warpgate or Orbital Command.</p>
<p>The timeline ends at <?php 
echo simple_time($timeEnds);
?>
.</p>
<?php 
开发者ID:iceeyhot,项目名称:sc2calc.org,代码行数:31,代码来源:update.php

示例3: runRichards

/**
 * The Richards benchmark simulates the task dispatcher of an
 * operating system.
 **/
function runRichards()
{
    $scheduler = new Scheduler();
    $scheduler->addIdleTask(ID_IDLE, 0, NULL, COUNT);
    $queue = new Packet(NULL, ID_WORKER, KIND_WORK);
    $queue = new Packet($queue, ID_WORKER, KIND_WORK);
    $scheduler->addWorkerTask(ID_WORKER, 1000, $queue);
    $queue = new Packet(NULL, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_A, 2000, $queue);
    $queue = new Packet(NULL, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_B, 3000, $queue);
    $scheduler->addDeviceTask(ID_DEVICE_A, 4000, NULL);
    $scheduler->addDeviceTask(ID_DEVICE_B, 5000, NULL);
    $scheduler->schedule();
    if ($scheduler->queueCount != EXPECTED_QUEUE_COUNT || $scheduler->holdCount != EXPECTED_HOLD_COUNT) {
        $error = "Error during execution: queueCount = " . $scheduler->queueCount . ", holdCount = " . $scheduler->holdCount . ".";
        throw new Exception($error);
    }
}
开发者ID:michaelprem,项目名称:phc,代码行数:27,代码来源:test_richards.php

示例4: Scheduler

    $scheduler = new Scheduler();
    $scheduler->addIdleTask(ID_IDLE, 0, null, COUNT);
    $queue = new Packet(null, ID_WORKER, KIND_WORK);
    $queue = new Packet($queue, ID_WORKER, KIND_WORK);
    $scheduler->addWorkerTask(ID_WORKER, 1000, $queue);
    $queue = new Packet(null, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_A, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_A, 2000, $queue);
    $queue = new Packet(null, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $queue = new Packet($queue, ID_DEVICE_B, KIND_DEVICE);
    $scheduler->addHandlerTask(ID_HANDLER_B, 3000, $queue);
    $scheduler->addDeviceTask(ID_DEVICE_A, 4000, null);
    $scheduler->addDeviceTask(ID_DEVICE_B, 5000, null);
    $scheduler->schedule();
    if ($scheduler->queueCount != EXPECTED_QUEUE_COUNT || $scheduler->holdCount != EXPECTED_HOLD_COUNT) {
        $msg = "Error during execution: queueCount = " . $scheduler->queueCount . ", holdCount = " . $scheduler->holdCount . ".";
        throw new Exception(msg);
    }
};
/**
 * A scheduler can be used to schedule a set of tasks based on their relative
 * priorities.  Scheduling is done by maintaining a list of task control blocks
 * which holds tasks and the data queue they are processing.
 * @constructor
 */
class Scheduler
{
    public $queueCount;
    public $holdCount;
开发者ID:badlamer,项目名称:hhvm,代码行数:31,代码来源:richards.php


注:本文中的Scheduler::schedule方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。