• Matthias Vallentin's avatar
    Add a profiled scheduler for workers and jobs. · cf590b53
    Matthias Vallentin authored
    The new profiled<Policy> scheduling policy wraps an existing policy and
    injects its own instrumentation calls to report to the
    profiled_coordinator scheduler. This coordinator enables fine-grained
    profiling of workers and jobs (actors) by calling getrusage before and
    after each job resumption. It logs its measurements at a given
    resolution to a file, with absolute and cumulative timings. One can
    activate the new scheduler as follows:
    
        set_scheduler(
          new scheduler::profiled_coordinator<>{
            "/tmp/caf.log", std::chrono::milliseconds{1000}, threads, thruput});
    
    This would log to "/tmp/caf.log" at a resolution of 1 second.
    
     Example output:
    
        clock                type      id        time           usr            sys            mem
        1424927236617568099  worker    0         37             0              37             0
        1424927236618379099  worker    6         252            0              252            0
        1424927236619565099  worker    2         221            0              221            0
        1424927236619592099  worker    31        289            0              289            0
        1424927236619794099  worker    3         100            0              100            0
        1424927236620048099  worker    4         141            0              141            0
        1424927236620153099  worker    5         62             0              62             0
        1424927236620386099  worker    20        115            0              114            0
        1424927236620491099  worker    19        819            0              819            0
        1424927236620516099  worker    8         190            0              190            0
        1424927236620677099  worker    12        132            0              132            0
        1424927236620850099  worker    7         217            0              124            0
        1424927236621032099  worker    9         96             0              96             0
        1424927236621694099  worker    10        628            0              124            0
        1424927236621912099  worker    16        264            0              264            0
        1424927236622057099  worker    11        282            0              154            0
        1424927236622304099  worker    13        79             0              79             0
        1424927236623102099  worker    30        26             0              26             0
        1424927236624706099  worker    1         7112           3804           0              18352
        1424927236731407099  worker    28        36             0              35             0
        1424927236837733099  worker    22        43             0              43             0
        1424927236837835099  worker    27        75             0              75             0
        1424927236839573099  worker    29        35649          35649          0              25900
        1424927236871105563  actor     35        32383          26454          5926           27176
        1424927236942629099  worker    23        15             0              15             0
        1424927236968763615  actor     49        32442          31431          417            1284
        1424927237018401099  worker    15        45911          45911          0              38124
        1424927237036407099  worker    21        63235          63235          0              40324
        1424927237056977099  worker    17        82448          77373          5073           23396
        1424927237057695778  actor     63        20914          20650          0              1604
        1424927237074907099  worker    25        18536          18536          0              43240
        1424927237120602099  worker    14        62290          61249          0              28848
    cf590b53
CMakeLists.txt 1.41 KB