// File: /workspace/github_cpp_makefile_star2_O1/Barath-Kannan[P]SignalsAndSlots/test/SignalTest_Parametrized.cpp
// Function: SignalTestParametrized_IntenseUsage_Test::TestBody()
TEST_P(SignalTestParametrized, IntenseUsage) {
    auto func = ([this](sigType x) {
        volatile sigType v = x;
        for (uint32_t i = 0; i < params.nOperations; i++) {
            v+=x;
        }
        completedFunctions++;
    });

    Signal<sigType> signal(params.threadSafe);
    cout << "Connecting " << params.nConnections << " functions" << endl;
    for (uint32_t i = 0; i < params.nConnections; i++) {
        signal.connectSlot(params.scheme, func);
    }

    FunctionTimeRegular<> printer([this]() {
        cout << "Total elements emitted: " << counter << " / " << params.nEmissions << fixed << endl;
        cout << "Emission rate: " << (double) counter / bt.getElapsedMilliseconds() << fixed << "m/ms" << endl;
        cout << "Total elements processed: " << completedFunctions << " / " << params.nEmissions * params.nConnections << fixed << endl;
        cout << "Operation rate: " << (double) completedFunctions * params.nOperations / bt2.getElapsedNanoseconds() << "m/ns" << endl;
        return (bt2.getElapsedSeconds() < 6000);
    }, std::chrono::milliseconds(500));

    FunctionTimeRegular<> checkFinished([this]() {
        return (completedFunctions != params.nEmissions * params.nConnections);
    }, std::chrono::milliseconds(1));

    cout << "Starting emission thread: " << endl;
    
    std::list<thread> emitters;
    for (uint32_t i=0; i<params.nEmitters; ++i){
        emitters.emplace_back([this, &signal, i]() {
            if (i==0){
                bt2.start();
                bt.start();
            }
            uint32_t current;
            while ((current = counter.fetch_add(1000)) < params.nEmissions-1000){
                for (uint32_t j=0; j<1000; ++j) signal.emitSignal(1);
            }
            if (current == params.nEmissions-1000){
                for (uint32_t j=0; j<1000; ++j) signal.emitSignal(1);
                bt.stop();
            }
        });
    }
    cout << "Emission thread spawned" << endl;
    cout.precision(std::numeric_limits<double>::max_digits10);
    for (auto &t : emitters){
        t.join();
    }
    cout << "Emission completed" << endl;
    checkFinished.join();
    bt2.stop();
    printer.stopAndJoin();
    cout << "Processing completed" << endl;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdi, %rbx
movb 0x28(%rdi), %al
xorl %r15d, %r15d
leaq 0x1b0(%rsp), %r14
movl %r15d, -0x40(%r14)
movb %al, -0x3c(%r14)
xorps %xmm0, %xmm0
movups %xmm0, -0x38(%r14)
movups %xmm0, -0x28(%r14)
movups %xmm0, -0x18(%r14)
movq %r15, -0x8(%r14)
movq %r14, %rdi
callq 0xb7c0
movb %r15b, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x30(%r14)
leaq 0x200(%rsp), %rax
movl %r15d, (%rax)
movq %r15, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
leaq 0x260(%rsp), %rax
movl %r15d, (%rax)
movq %r15, 0x8(%rax)
movups %xmm0, -0x40(%rax)
movups %xmm0, -0x30(%rax)
movups %xmm0, -0x20(%rax)
movb %r15b, -0x10(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
movq %r15, 0x20(%rax)
movq 0x4d0fd(%rip), %rdi     # 0x6afa0
leaq 0x2cf19(%rip), %rsi     # 0x4adc3
movl $0xb, %edx
callq 0xb600
movl 0x18(%rbx), %esi
movq 0x4d0e2(%rip), %rdi     # 0x6afa0
callq 0xb380
movq %rax, %r14
leaq 0x2cf02(%rip), %rsi     # 0x4adcf
movl $0xa, %edx
movq %rax, %rdi
callq 0xb600
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb390
cmpl $0x0, 0x18(%rbx)
je 0x1df6c
xorl %ebp, %ebp
leaq 0x12da(%rip), %r12      # 0x1f1ea
leaq 0x12f3(%rip), %r13      # 0x1f20a
leaq 0x170(%rsp), %r14
leaq 0x30(%rsp), %r15
movl 0x2c(%rbx), %esi
xorps %xmm0, %xmm0
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movq %rbx, 0x30(%rsp)
movq %r12, 0x48(%rsp)
movq %r13, 0x40(%rsp)
movq %r14, %rdi
movq %r15, %rdx
callq 0x1ff2c
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x1df65
movq %r15, %rdi
movq %r15, %rsi
movl $0x3, %edx
callq *%rax
incl %ebp
cmpl 0x18(%rbx), %ebp
jb 0x1df24
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %rbx, (%rsi)
leaq 0x12ab(%rip), %rax      # 0x1f230
movq %rax, 0x18(%rsi)
leaq 0x1506(%rip), %rax      # 0x1f496
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
movq $0x1f4, (%rdx)          # imm = 0x1F4
leaq 0xe0(%rsp), %rdi
callq 0x1ffa6
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x1dfc6
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
xorps %xmm0, %xmm0
leaq 0x10(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %rbx, (%rsi)
leaq 0x14dd(%rip), %rax      # 0x1f4bc
movq %rax, 0x18(%rsi)
leaq 0x14e6(%rip), %rax      # 0x1f4d0
movq %rax, 0x10(%rsi)
leaq 0x8(%rsp), %rdx
movq $0x1, (%rdx)
leaq 0x50(%rsp), %rdi
callq 0x1ffa6
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e01d
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x4cf7c(%rip), %r15     # 0x6afa0
leaq 0x2cdaf(%rip), %rsi     # 0x4adda
movl $0x1a, %edx
movq %r15, %rdi
callq 0xb600
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4cf4a(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0x10(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rax, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
cmpl $0x0, 0x24(%rbx)
je 0x1e10a
xorl %ebp, %ebp
leaq 0x170(%rsp), %r14
leaq 0x8(%rsp), %r12
leaq 0x10(%rsp), %r13
movl $0x18, %edi
callq 0xb4e0
movq %rax, %r15
movq $0x0, 0x10(%rax)
movl $0x20, %edi
callq 0xb4e0
movq %r15, %rdi
addq $0x10, %rdi
leaq 0x4b982(%rip), %rcx     # 0x69a48
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
movq %r14, 0x10(%rax)
movl %ebp, 0x18(%rax)
movq %rax, 0x8(%rsp)
movq %r12, %rsi
xorl %edx, %edx
callq 0xb4a0
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1e0f3
movq (%rdi), %rax
callq *0x8(%rax)
movq %r15, %rdi
movq %r13, %rsi
callq 0xb0a0
incq 0x20(%rsp)
incl %ebp
cmpl 0x24(%rbx), %ebp
jb 0x1e099
movq 0x4ce8f(%rip), %r15     # 0x6afa0
leaq 0x2ccdd(%rip), %rsi     # 0x4adf5
movl $0x17, %edx
movq %r15, %rdi
callq 0xb600
movq (%r15), %rax
addq -0x18(%rax), %r15
movq %r15, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4ce5d(%rip), %r15     # 0x6afa0
movq %r15, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq (%r15), %rax
movq -0x18(%rax), %rax
movq $0x11, 0x8(%r15,%rax)
leaq 0x10(%rsp), %r14
movq (%r14), %r14
leaq 0x10(%rsp), %rax
cmpq %rax, %r14
je 0x1e180
leaq 0x10(%r14), %rdi
callq 0xb9a0
jmp 0x1e168
movq 0x4ce19(%rip), %r14     # 0x6afa0
leaq 0x2cc7f(%rip), %rsi     # 0x4ae0d
movl $0x12, %edx
movq %r14, %rdi
callq 0xb600
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4cde7(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0xb0(%rsp), %rdi
callq 0xb9a0
addq $0x48, %rbx
movq %rbx, %rdi
callq 0xd6b4
xorl %eax, %eax
leaq 0x110(%rsp), %rdi
xchgb %al, -0x30(%rdi)
callq 0xb280
leaq 0x140(%rsp), %rdi
callq 0xb9a0
movq 0x4cd9b(%rip), %rbx     # 0x6afa0
leaq 0x2cc14(%rip), %rsi     # 0x4ae20
movl $0x14, %edx
movq %rbx, %rdi
callq 0xb600
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0xb4c0
movsbl %al, %esi
movq 0x4cd69(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0x10(%rsp), %rdi
callq 0x1538e
leaq 0x50(%rsp), %rdi
callq 0x200a0
leaq 0xe0(%rsp), %rdi
callq 0x200a0
leaq 0x170(%rsp), %rdi
callq 0x2287c
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e340
jmp 0x1e340
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e35f
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e35f
jmp 0x1e340
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x1e36c
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e36c
jmp 0x1e340
movq %rax, %rbx
jmp 0x1e355
movq %rax, %rbx
jmp 0x1e36c
jmp 0x1e340
jmp 0x1e348
jmp 0x1e348
movq %rax, %rbx
jmp 0x1e313
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x1e30a
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x8(%rsp)
movl $0x18, %esi
movq %r15, %rdi
callq 0xb510
jmp 0x1e34b
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x1e36c
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e36c
movq %rax, %rdi
callq 0xd81f
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x1538e
leaq 0x50(%rsp), %rdi
callq 0x200a0
leaq 0xe0(%rsp), %rdi
callq 0x200a0
leaq 0x170(%rsp), %rdi
callq 0x2287c
movq %rbx, %rdi
callq 0xba10
nop