// File: /workspace/github_cpp_makefile_star2_O1/Barath-Kannan[P]SignalsAndSlots/test/SignalTest_Parametrized.cpp
// Function: SignalTestParametrized_LengthyUsage_Test::TestBody()
TEST_P(SignalTestParametrized, LengthyUsage) {
    auto func = ([this](sigType x) {
        std::this_thread::sleep_for(std::chrono::nanoseconds(params.nOperations*1000));
        completedFunctions.fetch_add(1);
    });

    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;
    
    thread emitter([this, &signal]() {
        bt2.start();
        bt.start();
        for (counter=0; counter<params.nEmissions; ++counter) {
            signal.emitSignal(1);
        }
        bt.stop();
    });
    cout << "Emission thread spawned" << endl;
    
    cout.precision(std::numeric_limits<double>::max_digits10);
    emitter.join();
    cout << "Emission completed" << endl;
    checkFinished.join();
    bt2.stop();
    printer.stopAndJoin();
}

// 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 0x4c4c7(%rip), %rdi     # 0x6afa0
leaq 0x2c2e3(%rip), %rsi     # 0x4adc3
movl $0xb, %edx
callq 0xb600
movl 0x18(%rbx), %esi
movq 0x4c4ac(%rip), %rdi     # 0x6afa0
callq 0xb380
movq %rax, %r14
leaq 0x2c2cc(%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 0x1eba2
xorl %ebp, %ebp
leaq 0xe3a(%rip), %r12       # 0x1f980
leaq 0xe99(%rip), %r13       # 0x1f9e6
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 0x1eb9b
movq %r15, %rdi
movq %r15, %rsi
movl $0x3, %edx
callq *%rax
incl %ebp
cmpl 0x18(%rbx), %ebp
jb 0x1eb5a
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movq %rbx, (%rsi)
leaq 0xe51(%rip), %rax       # 0x1fa0c
movq %rax, 0x18(%rsi)
leaq 0x10ac(%rip), %rax      # 0x1fc72
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 0x1ebfc
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 0x1083(%rip), %rax      # 0x1fc98
movq %rax, 0x18(%rsi)
leaq 0x108c(%rip), %rax      # 0x1fcac
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 0x1ec53
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x4c346(%rip), %r14     # 0x6afa0
leaq 0x2c179(%rip), %rsi     # 0x4adda
movl $0x1a, %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 0x4c314(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq $0x0, 0x8(%rsp)
movl $0x18, %edi
callq 0xb4e0
leaq 0x4ae75(%rip), %rcx     # 0x69b28
movq %rcx, (%rax)
movq %rbx, 0x8(%rax)
leaq 0x170(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0x10(%rsp), %rsi
movq %rax, (%rsi)
leaq 0x8(%rsp), %rdi
xorl %edx, %edx
callq 0xb4a0
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1ecea
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x4c2af(%rip), %r14     # 0x6afa0
leaq 0x2c0fd(%rip), %rsi     # 0x4adf5
movl $0x17, %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 0x4c27d(%rip), %r14     # 0x6afa0
movq %r14, %rdi
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq (%r14), %rax
movq -0x18(%rax), %rax
movq $0x11, 0x8(%r14,%rax)
leaq 0x8(%rsp), %rdi
callq 0xb9a0
movq 0x4c24c(%rip), %r14     # 0x6afa0
leaq 0x2c0b2(%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 0x4c21a(%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
cmpq $0x0, 0x8(%rsp)
jne 0x1eea5
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 0x1eedd
jmp 0x1eedd
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1ee2a
movq (%rdi), %rax
callq *0x8(%rax)
movq $0x0, 0x10(%rsp)
jmp 0x1ee8c
jmp 0x1ee89
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1ee96
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1ee96
jmp 0x1eedd
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x1eec8
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1eec8
jmp 0x1eedd
jmp 0x1ee89
movq %rax, %rbx
jmp 0x1eec8
cmpq $0x0, 0x8(%rsp)
jne 0x1eea5
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x200a0
leaq 0xe0(%rsp), %rdi
callq 0x200a0
jmp 0x1eec8
callq 0xb130
jmp 0x1eedd
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x1eec8
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x170(%rsp), %rdi
callq 0x2287c
movq %rbx, %rdi
callq 0xba10
movq %rax, %rdi
callq 0xd81f