zoukankan      html  css  js  c++  java
  • Stacktack overview

    class Lifecycle(models.Model):
        """The Lifecycle table is the Master for a group of
        Timing detail records. There is one Lifecycle row for
        each instance seen in the event stream. The Timings
        relate to the execution time for each .start/.end event
        pair for this instance. These pairs are over the entire
        lifespan of the instance, even across multiple api requests."""
        instance = models.CharField(max_length=50, null=True,
                                    blank=True, db_index=True)
        last_state = models.CharField(max_length=50, null=True,
                                 blank=True, db_index=True)
        last_task_state = models.CharField(max_length=50, null=True,
                                 blank=True, db_index=True)
        last_raw = models.ForeignKey(RawData, null=True)

    class Timing(models.Model):
        """Each Timing record corresponds to a .start/.end event pair
        for an instance. It tracks how long it took this operation
        to execute."""
        name = models.CharField(max_length=50, db_index=True)
        lifecycle = models.ForeignKey(Lifecycle)
        start_raw = models.ForeignKey(RawData, related_name='+', null=True)
        end_raw = models.ForeignKey(RawData, related_name='+', null=True)

        start_when = models.DecimalField(null=True, max_digits=20,
                                         decimal_places=6)
        end_when = models.DecimalField(null=True, max_digits=20, decimal_places=6)

        diff = models.DecimalField(null=True, max_digits=20, decimal_places=6,
                                   db_index=True)

    def aggregate_lifecycle(raw):
        """Roll up the raw event into a Lifecycle object
        and a bunch of Timing objects.

        We can use this for summarized timing reports.

  • 相关阅读:
    POJ 2653 Pick-up sticks [线段相交 迷之暴力]
    POJ1556 The Doors [线段相交 DP]
    POJ 3304 Segments[直线与线段相交]
    POJ2318 TOYS[叉积 二分]
    挖坑
    HDU3488 Tour [有向环覆盖 费用流]
    BZOJ 3438: 小M的作物 [最小割]
    POJ 2125 Destroying The Graph [最小割 打印方案]
    网络流算法与建模总结
    CF266D. BerDonalds [图的绝对中心]
  • 原文地址:https://www.cnblogs.com/allcloud/p/5462041.html
Copyright © 2011-2022 走看看