• 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.

  • 相关阅读:
    学习博客
    file-max与ulimit的关系与差别
    buffer cache chain 图
    计算机体系结构 ---图2
    计算机体系结构-图
    工作于内存和文件之间的页缓存, Page Cache, the Affair Between Memory and Files
    Linux Kernel: buffers和cached的区别
    lnux内核的malloc实现(Oracle的cache buffer影子)
    内存管理概述、内存分配与释放、地址映射机制(mm_struct, vm_area_struct)、malloc/free 的实现
    Linux 内核的文件 Cache 管理机制介绍-ibm
  • 原文地址:https://www.cnblogs.com/allcloud/p/5462041.html
Copyright © 2020-2023  润新知