def main():
    f_diskstats = open("/proc/diskstats", "r")

    while True:
        # Scalyr edit to add in check for parent.  A ppid of 1 means our parent has died.
        if os.getppid() == 1:
            sys.exit(1)

        f_diskstats.seek(0)
        ts = int(time.time())
        for line in f_diskstats:
            # maj, min, devicename, [list of stats, see above]
            values = line.split(None)
            # shortcut the deduper and just skip disks that
            # haven't done a single read.  This elimiates a bunch
            # of loopback, ramdisk, and cdrom devices but still
            # lets us report on the rare case that we actually use
            # a ramdisk.
            if values[3] == "0":
                continue

            if int(values[1]) % 16 == 0 and int(values[0]) > 1:
                metric = "iostat.disk."
            else:
                metric = "iostat.part."

            # Sometimes there can be a slash in the device name, see bug #8.
            # TODO(tsuna): Remove the substitution once TSD allows `/' in tags.
            device = values[2].replace("/", "_")
            if len(values) == 14:
                # full stats line
                for i in range(11):
                    print ("%s%s %d %s dev=%s"
                           % (metric, FIELDS_DISK[i], ts, values[i+3],
                              device))
            elif len(values) == 7:
                # partial stats line
                for i in range(4):
                    print ("%s%s %d %s dev=%s"
                           % (metric, FIELDS_PART[i], ts, values[i+3],
                              device))
            else:
                print >> sys.stderr, "Cannot parse /proc/diskstats line: ", line
                continue

        sys.stdout.flush()
        time.sleep(COLLECTION_INTERVAL)
Return a list of (name,value) tuples for variables/expressions
dataset/ETHPy150Open scalyr/scalyr-agent-2/scalyr_agent/third_party/tcollector/collectors/0/iostat.py/main--crossover with--dataset/ETHPy150Open OpenMDAO/OpenMDAO-Framework/openmdao.main/src/openmdao/main/case.py/Case.items