// File: /workspace/github_cpp_makefile_star2_O3/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 0x4ca29(%rip), %rdi     # 0x6afa0
leaq 0x2c875(%rip), %rsi     # 0x4adf3
movl $0xb, %edx
callq 0xb600
movl 0x18(%rbx), %esi
movq 0x4ca0e(%rip), %rdi     # 0x6afa0
callq 0xb380
movq %rax, %r14
leaq 0x2c85e(%rip), %rsi     # 0x4adff
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 0x1e63c
xorl %ebp, %ebp
leaq 0xe26(%rip), %r12       # 0x1f40a
leaq 0xe83(%rip), %r13       # 0x1f46e
leaq 0x170(%rsp), %r14
leaq 0x30(%rsp), %r15
movl 0x2c(%rbx), %esi
movq $0x0, 0x38(%rsp)
movq %rbx, 0x30(%rsp)
movq %r12, 0x48(%rsp)
movq %r13, 0x40(%rsp)
movq %r14, %rdi
movq %r15, %rdx
callq 0x1f9b4
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x1e635
movq %r15, %rdi
movq %r15, %rsi
movl $0x3, %edx
callq *%rax
incl %ebp
cmpl 0x18(%rbx), %ebp
jb 0x1e5f8
leaq 0x50(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movq %rbx, (%rsi)
leaq 0xe41(%rip), %rax       # 0x1f494
movq %rax, 0x18(%rsi)
leaq 0x109c(%rip), %rax      # 0x1f6fa
movq %rax, 0x10(%rsi)
leaq 0x10(%rsp), %rdx
movq $0x1f4, (%rdx)          # imm = 0x1F4
leaq 0xe0(%rsp), %rdi
callq 0x1fa2e
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x1e694
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x10(%rsp), %rsi
movq $0x0, 0x8(%rsi)
movq %rbx, (%rsi)
leaq 0x1075(%rip), %rax      # 0x1f720
movq %rax, 0x18(%rsi)
leaq 0x107e(%rip), %rax      # 0x1f734
movq %rax, 0x10(%rsi)
leaq 0x8(%rsp), %rdx
movq $0x1, (%rdx)
leaq 0x50(%rsp), %rdi
callq 0x1fa2e
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e6e9
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x4c8b0(%rip), %r14     # 0x6afa0
leaq 0x2c713(%rip), %rsi     # 0x4ae0a
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 0x4c87e(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
movq $0x0, 0x8(%rsp)
movl $0x18, %edi
callq 0xb4e0
leaq 0x4b3f7(%rip), %rcx     # 0x69b40
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 0x1e780
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x4c819(%rip), %r14     # 0x6afa0
leaq 0x2c697(%rip), %rsi     # 0x4ae25
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 0x4c7e7(%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 0x4c7b6(%rip), %r14     # 0x6afa0
leaq 0x2c64c(%rip), %rsi     # 0x4ae3d
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 0x4c784(%rip), %rdi     # 0x6afa0
callq 0xb050
movq %rax, %rdi
callq 0xb390
leaq 0xb0(%rsp), %rdi
callq 0xb9a0
addq $0x48, %rbx
movq %rbx, %rdi
callq 0xd664
xorl %eax, %eax
leaq 0x110(%rsp), %rdi
xchgb %al, -0x30(%rdi)
callq 0xb280
leaq 0x140(%rsp), %rdi
callq 0xb9a0
cmpq $0x0, 0x8(%rsp)
jne 0x1e932
leaq 0x50(%rsp), %rdi
callq 0x1fb28
leaq 0xe0(%rsp), %rdi
callq 0x1fb28
leaq 0x170(%rsp), %rdi
callq 0x223c6
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x1e96a
jmp 0x1e96a
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x1e919
movq (%rdi), %rax
callq *0x8(%rax)
jmp 0x1e919
jmp 0x1e916
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x1e923
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e923
jmp 0x1e96a
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x1e955
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1e955
jmp 0x1e96a
jmp 0x1e916
movq %rax, %rbx
jmp 0x1e955
cmpq $0x0, 0x8(%rsp)
jne 0x1e932
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x1fb28
leaq 0xe0(%rsp), %rdi
callq 0x1fb28
jmp 0x1e955
callq 0xb130
jmp 0x1e96a
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x1e955
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
leaq 0x170(%rsp), %rdi
callq 0x223c6
movq %rbx, %rdi
callq 0xba10
movq %rax, %rdi
callq 0xd7cf