diff --git a/.gitignore b/.gitignore index 134d647..491c05e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,17 +1,7 @@ ## OI specific build/ -test.o -test/tester -test/mttest? -test/mttest2_inline test/integration_mttest -test/integration_cycles test/integration_sleepy -test/integration_packed -test/mapiter -test/userDef1 -test/vector -test/inlined_test test/.autogen-* oi_preprocessed *_test.oid @@ -22,7 +12,6 @@ Testing *.o PADDING failed -fb_*_wrapper.sh website/node_modules ## Vim diff --git a/test/Makefile b/test/Makefile index 81303fe..095862c 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,9 +2,8 @@ CXX=clang++ CXXFLAGS=-g -fdebug-types-section -I../extern/folly -O2 -pthread -no-pie FILTER ?= -TARGETS=integration_mttest integration_sleepy integration_packed integration_cycles mapiter mttest1 mttest2 mttest2_inline mttest3 mttest4 tester userDef1 vector inlined_test +TARGETS=integration_mttest integration_sleepy -mttest2_inline: CXXFLAGS+=-DMTTEST2_INLINE_DO_STUFF all: $(TARGETS) clean: diff --git a/test/TARGETS b/test/TARGETS deleted file mode 100644 index ba46f65..0000000 --- a/test/TARGETS +++ /dev/null @@ -1,31 +0,0 @@ -load("@fbcode_macros//build_defs:cpp_binary.bzl", "cpp_binary") - -cpp_binary( - name = "mapiter", - srcs = ["mapiter.cpp"], - deps = [ - ], -) - -cpp_binary( - name = "vector", - srcs = ["vector.cpp"], - deps = [ - ], -) - -cpp_binary( - name = "userDef1", - srcs = ["userDef1.cpp"], - deps = [ - ], -) - -cpp_binary( - name = "mttest1", - srcs = ["mttest1.cpp"], - deps = [ - "//common/init:init", - ], - external_deps = [("glibc", None, "pthread")], -) diff --git a/test/inlined_test.cpp b/test/inlined_test.cpp deleted file mode 100644 index 185bb67..0000000 --- a/test/inlined_test.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include - -#include -#include - -#define INLINE static inline __attribute__((always_inline)) - -template -INLINE std::vector combine(const std::vector& x, - const std::vector& y) { - std::vector combined; - combined.reserve(x.size() + y.size()); - for (auto& elem : x) - combined.push_back(elem); - for (auto& elem : y) - combined.push_back(elem); - return combined; -} - -template -INLINE std::vector flatten(const std::vector>& vec) { - std::vector flattened; - for (auto& elem : vec) - flattened = combine(elem, flattened); - return flattened; -} - -template -INLINE std::vector flatten_combine(const std::vector>& x, - const std::vector>& y) { - auto x_flat = flatten(x); - auto y_flat = flatten(y); - return combine(x_flat, y_flat); -} - -#define MAX_SIZE 256 - -void fill(std::vector& vec, int n) { - n %= MAX_SIZE; - vec.clear(); - vec.reserve(n); - for (int i = 0; i < n; i++) - vec.push_back(rand()); -} - -void fill_vec(std::vector>& vec, int n) { - n %= MAX_SIZE; - vec.clear(); - vec.reserve(n); - for (int i = 0; i < n; i++) { - vec.emplace_back(); - auto& last = vec.back(); - fill(last, rand()); - } -} - -int main() { - size_t exit_code = 0; - for (int i = 0; i < 100; i++) { - std::vector> x; - std::vector> y; - fill_vec(x, rand()); - fill_vec(y, rand()); - auto result = flatten_combine(x, y); - for (auto value : result) - exit_code += rand() % (value + 1); - sleep(1); - } - return (int)exit_code; -} diff --git a/test/inlined_test_flatten.oid b/test/inlined_test_flatten.oid deleted file mode 100644 index 98efc01..0000000 --- a/test/inlined_test_flatten.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_ZL7flattenIiESt6vectorIT_SaIS1_EERKS0_IS3_SaIS3_EE:arg0 diff --git a/test/inlined_test_flatten_combine.oid b/test/inlined_test_flatten_combine.oid deleted file mode 100644 index 731c548..0000000 --- a/test/inlined_test_flatten_combine.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_ZL15flatten_combineIiESt6vectorIT_SaIS1_EERKS0_IS3_SaIS3_EES7_:arg0 diff --git a/test/integration.py b/test/integration.py index e8850de..e5e57ef 100644 --- a/test/integration.py +++ b/test/integration.py @@ -64,7 +64,6 @@ class OIDebuggerTestCase(unittest.TestCase): ) self.custom_generated_code_file = f"{self.temp.name}/custom_oid_output.cpp" - self.script_packed = f"{self.temp.name}/integration_packed_arg0.oid" self.default_script = "integration_entry_doStuff_arg0.oid" def tearDown(self): diff --git a/test/integration_cycles.cpp b/test/integration_cycles.cpp deleted file mode 100644 index 302ab61..0000000 --- a/test/integration_cycles.cpp +++ /dev/null @@ -1,83 +0,0 @@ -#include -#include - -#include -#include - -struct RawNode { - uint64_t value; - struct RawNode* next; -}; - -void __attribute__((noinline)) rawPointerCycle(struct RawNode* node) { - for (int i = 0; node && i < 10; i++) { - node->value++; - node = node->next; - } -} - -struct UniqueNode { - uint64_t value; - std::unique_ptr next; -}; - -void __attribute__((noinline)) uniquePointerCycle(struct UniqueNode* node) { - for (int i = 0; node && i < 10; i++) { - node->value++; - node = node->next.get(); - } -} - -struct SharedNode { - uint64_t value; - std::shared_ptr next; -}; - -void __attribute__((noinline)) sharedPointerCycle(struct SharedNode* node) { - for (int i = 0; node && i < 10; i++) { - node->value++; - node = node->next.get(); - } -} - -int main(int argc, char** argv) { - if (argc < 2) { - fprintf(stderr, - "One of 'raw', 'unique', or 'shared' should be provided as an " - "argument\n"); - return EXIT_FAILURE; - } - if (strcmp(argv[1], "raw") == 0) { - RawNode third{2, nullptr}, second{1, &third}, first{0, &second}; - third.next = &first; - for (int i = 0; i < 1000; i++) { - rawPointerCycle(&first); - sleep(1); - } - } else if (strcmp(argv[1], "unique") == 0) { - std::unique_ptr first = std::make_unique(); - UniqueNode* firstPtr = first.get(); - first->next = std::make_unique(); - first->next->next = std::make_unique(); - first->next->next->next = std::move(first); - for (int i = 0; i < 1000; i++) { - uniquePointerCycle(firstPtr); - sleep(1); - } - } else if (strcmp(argv[1], "shared") == 0) { - std::shared_ptr first = std::make_shared(); - SharedNode* firstPtr = first.get(); - first->next = std::make_shared(); - first->next->next = std::make_shared(); - first->next->next->next = first; - for (int i = 0; i < 1000; i++) { - sharedPointerCycle(firstPtr); - sleep(1); - } - } else { - fprintf(stderr, - "One of 'raw', 'unique', or 'shared' should be provided as an " - "argument\n"); - return EXIT_FAILURE; - } -} diff --git a/test/integration_cycles_raw.oid b/test/integration_cycles_raw.oid deleted file mode 100644 index 254e45e..0000000 --- a/test/integration_cycles_raw.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z15rawPointerCycleP7RawNode:arg0 diff --git a/test/integration_cycles_shared.oid b/test/integration_cycles_shared.oid deleted file mode 100644 index dd8a75b..0000000 --- a/test/integration_cycles_shared.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z18sharedPointerCycleP10SharedNode:arg0 diff --git a/test/integration_cycles_unique.oid b/test/integration_cycles_unique.oid deleted file mode 100644 index 026b9cb..0000000 --- a/test/integration_cycles_unique.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z18uniquePointerCycleP10UniqueNode:arg0 diff --git a/test/integration_entry_badFunc_arg0.oid b/test/integration_entry_badFunc_arg0.oid deleted file mode 100644 index da861e4..0000000 --- a/test/integration_entry_badFunc_arg0.oid +++ /dev/null @@ -1 +0,0 @@ -entry:badFunc:arg0 diff --git a/test/integration_entry_doStuff_arg0_arg1.oid b/test/integration_entry_doStuff_arg0_arg1.oid deleted file mode 100644 index e77f350..0000000 --- a/test/integration_entry_doStuff_arg0_arg1.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg0,arg1 diff --git a/test/integration_entry_incVectSize_arg0.oid b/test/integration_entry_incVectSize_arg0.oid deleted file mode 100644 index b5a6911..0000000 --- a/test/integration_entry_incVectSize_arg0.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_ZN3Foo11incVectSizeESt6vectorIiSaIiEE:arg0 diff --git a/test/integration_entry_inc_this.oid b/test/integration_entry_inc_this.oid deleted file mode 100644 index 87cd523..0000000 --- a/test/integration_entry_inc_this.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_ZN3Foo3incEv:this diff --git a/test/integration_global_myGlobalFoo.oid b/test/integration_global_myGlobalFoo.oid deleted file mode 100644 index 19fb215..0000000 --- a/test/integration_global_myGlobalFoo.oid +++ /dev/null @@ -1 +0,0 @@ -global:myGlobalFoo diff --git a/test/integration_mt.cpp b/test/integration_mt.cpp deleted file mode 100644 index 0359244..0000000 --- a/test/integration_mt.cpp +++ /dev/null @@ -1,60 +0,0 @@ -#include -#include -#include -#include - -struct Foo { - std::vector>> xs; -}; - -Foo& doStuff(Foo& f) { - std::vector> xs = {{5, 6, 7, 8}}; - f.xs.emplace_back(std::move(xs)); - return f; -} - -void run(long iteration_count) { - for (long i = 0; i < iteration_count; ++i) { - std::chrono::microseconds sleep_time{std::rand() & 0x7f}; - std::this_thread::sleep_for(sleep_time); - - Foo f{{ - { - {1, 2, 3}, - {4, 5, 6}, - }, - }}; - - doStuff(f); - } -} - -void usage(char* prog, int exit_status) { - std::printf("usage: %s \n", prog); - exit(exit_status); -} - -int main(int argc, char* argv[]) { - if (argc != 3) - usage(argv[0], EXIT_FAILURE); - - long iteration_count = atol(argv[1]); - if (iteration_count <= 0) - usage(argv[0], EXIT_FAILURE); - - int thread_count = atoi(argv[2]); - if (thread_count <= 0) - usage(argv[0], EXIT_FAILURE); - - std::srand(std::time(nullptr)); - - std::vector threads; - threads.reserve(thread_count); - for (int i = 0; i < thread_count; ++i) - threads.emplace_back(run, iteration_count); - - for (auto& t : threads) - t.join(); - - return EXIT_SUCCESS; -} diff --git a/test/integration_mt_entry_doStuff_arg0.oid b/test/integration_mt_entry_doStuff_arg0.oid deleted file mode 100644 index 6821168..0000000 --- a/test/integration_mt_entry_doStuff_arg0.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z7doStuffR3Foo:arg0 diff --git a/test/integration_packed.cpp b/test/integration_packed.cpp deleted file mode 100644 index b2057c9..0000000 --- a/test/integration_packed.cpp +++ /dev/null @@ -1,89 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -// #include "common/init/Init.h" - -static char textPad __attribute__((used)); - -struct __attribute__((__packed__)) Foo { - char *p; /* 8 bytes */ - char c; /* 1 byte */ - long x; /* 8 bytes */ -}; - -// struct Foo { -// char *p; /* 8 bytes */ -// char c; /* 8 byte */ -// long x; /* 8 bytes */ -// }; - -Foo myGlobalFoo; - -// pass in the loop counter in the args -int doStuff(Foo &foo) { - return foo.x; -} - -void *doit(void *arg) { - int *loopcnt = reinterpret_cast(arg); - - for (int i = 0; i < *loopcnt; ++i) { - Foo foo; - foo.x = *loopcnt; - - int result = doStuff(foo); - - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - } - pthread_exit(arg); -} - -int main(int argc, char *argv[]) { - int i = 0; - int err; - pthread_t tid[2]; - char *b; - - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::cout << "main thread = " << syscall(SYS_gettid) << " pid = " << getpid() - << std::endl; - sleep(1); - - for (int i = 0; i < 1; ++i) { - err = pthread_create(&(tid[i]), NULL, &doit, (void **)&loopcnt); - - if (err != 0) { - std::cout << "Failed to create thread:[ " << strerror(err) << " ]" - << std::endl; - } - } - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - for (int i = 0; i < 1; ++i) { - pthread_join(tid[i], (void **)&b); - } - - exit(EXIT_SUCCESS); -} diff --git a/test/integration_packed_arg0.oid b/test/integration_packed_arg0.oid deleted file mode 100644 index 6821168..0000000 --- a/test/integration_packed_arg0.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z7doStuffR3Foo:arg0 diff --git a/test/integration_return_doStuff_arg0.oid b/test/integration_return_doStuff_arg0.oid deleted file mode 100644 index dc1d792..0000000 --- a/test/integration_return_doStuff_arg0.oid +++ /dev/null @@ -1 +0,0 @@ -return:_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg0 diff --git a/test/integration_return_doStuff_retval.oid b/test/integration_return_doStuff_retval.oid deleted file mode 100644 index 9812fe6..0000000 --- a/test/integration_return_doStuff_retval.oid +++ /dev/null @@ -1 +0,0 @@ -return:_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:retval diff --git a/test/integration_return_inc_this.oid b/test/integration_return_inc_this.oid deleted file mode 100644 index eb0276e..0000000 --- a/test/integration_return_inc_this.oid +++ /dev/null @@ -1 +0,0 @@ -return:_ZN3Foo3incEv:this diff --git a/test/mapiter.cpp b/test/mapiter.cpp deleted file mode 100644 index bef9185..0000000 --- a/test/mapiter.cpp +++ /dev/null @@ -1,58 +0,0 @@ -#include - -#include -#include -#include -#include -#include - -int main(int argc, char *argv[]) { - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::map mapOfWords; - mapOfWords.insert(std::make_pair("earth", 1)); - mapOfWords.insert(std::make_pair("moon", 2)); - mapOfWords["sun"] = 3; - - std::vector nameList; - nameList.push_back("The quick brown fox"); - nameList.push_back("jumps over "); - nameList.push_back("the "); - nameList.push_back("lazy dog "); - - for (auto it = nameList.begin(); it != nameList.end(); it++) { - std::cout << "nameList: " << *it << " size: " << it->size() << std::endl; - } - - std::cout << "mapOfWords #elements: " << mapOfWords.size() << std::endl; - - // std::map::iterator it = mapOfWords.begin(); - // std::map::iterator end = mapOfWords.end(); - - int size = 0; - - for (auto it = mapOfWords.begin(); it != mapOfWords.end(); ++it) { - size += it->first.size(); - } - - std::cout << "mapOfWords map addr = " << &mapOfWords << std::endl; - std::cout << "nameList vector addr = " << &nameList << std::endl; - - std::cout << "pid == " << getpid() << " (hit RETURN to continue)" - << std::endl; - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - std::cout << "Total size of strings in mapOfWords is " << size << " bytes" - << std::endl; - - return 0; -} diff --git a/test/mttest1.cpp b/test/mttest1.cpp deleted file mode 100644 index 160c5c5..0000000 --- a/test/mttest1.cpp +++ /dev/null @@ -1,146 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -// #include "common/init/Init.h" - -static char textPad __attribute__((used)); - -// pass in the loop counter in the args -std::vector doStuff(std::vector &f, int i) { - std::vector altvect = {1, 3, 5, 7}; - - std::cout << " doStuff entries: " << f.size() << std::endl; - std::cout << " addr of f = " << reinterpret_cast(&f) << std::endl; - - for (int j = 0; j < 40; ++j) { - f.push_back(j); - } - - std::cout << " doStuff entries: " << f.size() << std::endl; - -#if 0 - if (i % 2) - { - std::vector altvect = { 1,3,5,7 }; - return altvect; - /* asm("" : : "a"(altvect)); */ - /* __asm__ volatile ("movl %%rax %0" - ::"m"(altvect):); */ - /* __asm__ volatile ("retq"); */ - } -#endif - - std::cout << syscall(SYS_gettid) << " " << i << "f = " << std::hex << &f - << std::endl; - - std::vector newvect(altvect); - - std::cout << " addr of newvect = " << reinterpret_cast(&newvect) - << std::endl; - - return newvect; -} - -#if 0 -void doStuff(std::vector &f, int i) -{ - f.push_back(i); - - if (i > 1000000) - __asm__ volatile ("retq"); - - std::cout << syscall(SYS_gettid) << " " << i - << "f = " << std::hex << &f << std::endl; -} -#endif - -void *doit(void *arg) { - int *loopcnt = reinterpret_cast(arg); - std::vector f; - - for (int i = 0; i < *loopcnt; ++i) { - std::vector g = doStuff(f, i); - - std::cout << "Number of elems = " << g.size() << std::endl; - - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - - f.clear(); - } - - pthread_exit(arg); -} - -int main(int argc, char *argv[]) { - int i = 0; - int err; - pthread_t tid[2]; - char *b; - - // facebook::initFacebook(&argc, &argv); - - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::cout << "main thread = " << syscall(SYS_gettid) << " pid = " << getpid() - << std::endl; - sleep(1); - - std::map mapOfWords; - mapOfWords.insert(std::make_pair("earth", 1)); - mapOfWords.insert(std::make_pair("moon", 2)); - mapOfWords["sun"] = 3; - - std::vector nameList; - nameList.push_back("The quick brown fox"); - nameList.push_back("jumps over "); - nameList.push_back("the "); - nameList.push_back("lazy dog "); - - for (auto it = nameList.begin(); it != nameList.end(); it++) { - std::cout << "nameList: " << *it << " size: " << it->size() << std::endl; - } - - std::cout << "mapOfWords #elements: " << mapOfWords.size() << std::endl; - - int size = 0; - - for (auto it = mapOfWords.begin(); it != mapOfWords.end(); ++it) { - size += it->first.size(); - } - - std::cout << "mapOfWords map addr = " << &mapOfWords << std::endl; - std::cout << "nameList vector addr = " << &nameList << std::endl; - - for (int i = 0; i < 1; ++i) { - err = pthread_create(&(tid[i]), NULL, &doit, (void **)&loopcnt); - - if (err != 0) { - std::cout << "Failed to create thread:[ " << strerror(err) << " ]" - << std::endl; - } - } - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - for (int i = 0; i < 1; ++i) { - pthread_join(tid[i], (void **)&b); - } - - exit(EXIT_SUCCESS); -} diff --git a/test/mttest2.cpp b/test/mttest2.cpp deleted file mode 100644 index 2f91c38..0000000 --- a/test/mttest2.cpp +++ /dev/null @@ -1,254 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "mttest.h" -// #include "common/init/Init.h" - -static char textPad __attribute__((used)); - -typedef union { - int i; - float f; - char c; -} UN; -typedef UN UN2; -typedef struct { - int i; - float f; - char c; -} ST; -typedef ST ST2; - -class FooParent { - int aa; -}; - -class Foo : FooParent { - public: - bool aBool; - short aShort; - std::vector> vectorOfStr; - std::multimap intToStrMultiMap; - std::map map; - std::unordered_map - unorderedMap; - char arr[10]; - int aa; - int bb : 1; - int : 0; - int cc : 5; - int dd : 30; - - // Bar bar_arr[5]; - int ref; - std::function testFunc; - std::deque testDeque; - - std::queue> testQueue; -}; - -Foo myGlobalFoo; -// std::unique_ptr myGlobalFoo; - -// pass in the loop counter in the args -#ifdef MTTEST2_INLINE_DO_STUFF -static inline __attribute__((always_inline)) -#endif -std::vector -doStuff(Foo &foo, std::vector> &m, - std::vector &f, - std::vector> &p) { - std::vector altvect = {1, 3, 5, 7}; - foo.ref++; - myGlobalFoo.vectorOfStr.push_back(std::string("Test String")); - - std::cout << " doStuff entries: " << f.size() << std::endl; - std::cout << " addr of f = " << reinterpret_cast(&f) << std::endl; - std::cout << " addr of m = " << reinterpret_cast(&m) << std::endl; - std::cout << " addr of p = " << reinterpret_cast(&p) << std::endl; - std::cout << " addr of myGlobalFoo = " - << reinterpret_cast(&myGlobalFoo) << std::endl; - - std::vector newvect(altvect); - - std::cout << " addr of newvect = " << reinterpret_cast(&newvect) - << std::endl; - - return newvect; -} - -void doStuff(std::vector &f, int i) { - f.push_back(i); - std::cout << "Entries in f: " << f.size() << std::endl; -} - -void doNothing() { - std::cout << "I do nothing, the function does nothing" << std::endl; -} - -void *doit(void *arg) { - doNothing(); - int *loopcnt = reinterpret_cast(arg); - std::vector f; - f.reserve(200); - std::vector> mv; - - std::unordered_map m; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = "ba"; - m["a"] = "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbaaaaaaaaaaa"] = "bbb"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccaaaaaaaa"] = "bbbb"; - - mv.push_back(m); - mv.push_back(m); - mv.push_back(m); - - std::vector> pv; - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdef", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdefghi", 10); - pv.push_back(p); - } - - for (int i = 0; i < *loopcnt; ++i) { - for (int j = 0; j < 3; j++) { - f.push_back("abcdefghijklmn"); - } - for (int j = 0; j < 3; j++) { - f.push_back( - "abcdefghijklmnoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - } - Foo foo; - - std::multimap mm; - - mm.insert(std::pair(0, 0)); - mm.insert(std::pair(1, 10)); - mm.insert(std::pair(2, 20)); - mm.insert(std::pair(3, 30)); - - mm.insert(std::pair(1, 100)); - - foo.intToStrMultiMap = mm; - - /*foo.vectorOfStr = f; - foo.mapOfStr = mv; - foo.vectorOfPair = pv;*/ - /*foo.bar_arr[0].bar = ""; - foo.bar_arr[1].bar = "0123456789"; - foo.bar_arr[2].bar = "01234567890123456789"; - foo.bar_arr[3].bar = "0123456789012345678901234567890123456789"; - foo.bar_arr[4].bar = - "01234567890123456789012345678901234567890123456789012345678901234567890123456789";*/ - - foo.testFunc = [](int n) { std::cout << n << std::endl; }; - foo.testQueue.push(1); - foo.testQueue.push(2); - foo.testQueue.push(3); - - foo.testDeque.push_back(5); - - std::vector> dummy; - std::vector g = doStuff(foo, dummy, f, pv); - doStuff(g, i); - - std::cout << "Number of elems = " << g.size() << std::endl; - - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - - f.clear(); - } - - pthread_exit(arg); -} - -int main(int argc, char *argv[]) { - int i = 0; - int err; - pthread_t tid[2]; - char *b; - - // facebook::initFacebook(&argc, &argv); - - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::cout << "main thread = " << syscall(SYS_gettid) << " pid = " << getpid() - << std::endl; - sleep(1); - - std::map mapOfWords; - mapOfWords.insert(std::make_pair("earth", 1)); - mapOfWords.insert(std::make_pair("moon", 2)); - mapOfWords["sun"] = 3; - - std::vector nameList; - nameList.push_back("The quick brown fox"); - nameList.push_back("jumps over "); - nameList.push_back("the "); - nameList.push_back("lazy dog "); - - for (auto it = nameList.begin(); it != nameList.end(); it++) { - std::cout << "nameList: " << *it << " size: " << it->size() << std::endl; - } - - std::cout << "mapOfWords #elements: " << mapOfWords.size() << std::endl; - - int size = 0; - - for (auto it = mapOfWords.begin(); it != mapOfWords.end(); ++it) { - size += it->first.size(); - } - - std::cout << "mapOfWords map addr = " << &mapOfWords << std::endl; - std::cout << "nameList vector addr = " << &nameList << std::endl; - - for (int i = 0; i < 1; ++i) { - err = pthread_create(&(tid[i]), NULL, &doit, (void **)&loopcnt); - - if (err != 0) { - std::cout << "Failed to create thread:[ " << strerror(err) << " ]" - << std::endl; - } - } - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - for (int i = 0; i < 1; ++i) { - pthread_join(tid[i], (void **)&b); - } - - exit(EXIT_SUCCESS); -} diff --git a/test/mttest2_do_it_arg0_script_void_pointer.oid b/test/mttest2_do_it_arg0_script_void_pointer.oid deleted file mode 100644 index ddc7a02..0000000 --- a/test/mttest2_do_it_arg0_script_void_pointer.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z4doitPv:arg0 diff --git a/test/mttest2_do_stuff_arg0_script.oid b/test/mttest2_do_stuff_arg0_script.oid deleted file mode 100644 index 0e3ea0c..0000000 --- a/test/mttest2_do_stuff_arg0_script.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg0 diff --git a/test/mttest2_do_stuff_arg0_script_comments.oid b/test/mttest2_do_stuff_arg0_script_comments.oid deleted file mode 100644 index e24ab42..0000000 --- a/test/mttest2_do_stuff_arg0_script_comments.oid +++ /dev/null @@ -1,14 +0,0 @@ -// Comment exemple at the start of a line -/* Single-line comment */ -/* Multi-lines - * comment - */ -/* ****** **//**//***/ -/*//*/ -// /* -// */ -entry:/* Within-line comment */_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg2 // Comment at the end of a line -// End of probe list -/* No more probes - * to see - * here */ diff --git a/test/mttest2_do_stuff_arg0_script_spaces.oid b/test/mttest2_do_stuff_arg0_script_spaces.oid deleted file mode 100644 index d5737fc..0000000 --- a/test/mttest2_do_stuff_arg0_script_spaces.oid +++ /dev/null @@ -1 +0,0 @@ -entry :_Z7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg0 diff --git a/test/mttest2_inline.cpp b/test/mttest2_inline.cpp deleted file mode 120000 index 83221de..0000000 --- a/test/mttest2_inline.cpp +++ /dev/null @@ -1 +0,0 @@ -mttest2.cpp \ No newline at end of file diff --git a/test/mttest2_inline_script.oid b/test/mttest2_inline_script.oid deleted file mode 100644 index 5df8b06..0000000 --- a/test/mttest2_inline_script.oid +++ /dev/null @@ -1 +0,0 @@ -entry:_ZL7doStuffR3FooRSt6vectorISt3mapINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES8_St4lessIS8_ESaISt4pairIKS8_S8_EEESaISF_EERS1_IS8_SaIS8_EERS1_ISB_IS8_dESaISM_EE:arg0 diff --git a/test/mttest3.cpp b/test/mttest3.cpp deleted file mode 100644 index 8ee3302..0000000 --- a/test/mttest3.cpp +++ /dev/null @@ -1,233 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -// #include "common/init/Init.h" - -static char textPad __attribute__((used)); - -typedef union { - int i; - float f; - char c; -} UN; -typedef UN UN2; -typedef struct { - int i; - float f; - char c; -} ST; -typedef ST ST2; - -// typedef struct vec_struct VEC; - -struct vec_struct { - std::vector v; -}; - -class BaseFoo { - int base[64]; -}; - -enum Color { Red, Green, Blue }; - -#define DIM 3 - -class Foo : BaseFoo { - public: - enum Color { red, green, blue } col; - ST a[8][8]; - vec_struct b[DIM][DIM][DIM]; - Color color; - char c[10]; - // VEC d[10]; - std::unique_ptr ptr; - std::shared_ptr ptr2; - std::vector vectorOfStr; - std::vector> mapOfStr; - std::vector> vectorOfPair; - UN unionVar; - UN2 unionVar2; - ST structVar; - ST2 structVar2; - int ref; -}; - -// pass in the loop counter in the args -std::vector doStuff(Foo &foo, - std::vector> &m, - std::vector &f, - std::vector> &p) { - std::vector altvect = {1, 3, 5, 7}; - foo.ref++; - - std::cout << " doStuff entries: " << f.size() << std::endl; - std::cout << " addr of f = " << reinterpret_cast(&f) << std::endl; - std::cout << " addr of m = " << reinterpret_cast(&m) << std::endl; - std::cout << " addr of p = " << reinterpret_cast(&p) << std::endl; - - std::vector newvect(altvect); - - std::cout << " addr of newvect = " << reinterpret_cast(&newvect) - << std::endl; - - return newvect; -} - -#if 0 -void doStuff(std::vector &f, int i) -{ - f.push_back(i); - - if (i > 1000000) - __asm__ volatile ("retq"); - - std::cout << syscall(SYS_gettid) << " " << i - << "f = " << std::hex << &f << std::endl; -} -#endif - -void *doit(void *arg) { - int *loopcnt = reinterpret_cast(arg); - std::vector f; - std::vector> mv; - - std::map m; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = "ba"; - m["a"] = "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbaaaaaaaaaaa"] = "bbb"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccaaaaaaaa"] = "bbbb"; - - mv.push_back(m); - mv.push_back(m); - mv.push_back(m); - - std::vector> pv; - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdef", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdefghi", 10); - pv.push_back(p); - } - - Foo foo; - - for (int i = 0; i < DIM; i++) { - for (int j = 0; j < DIM; j++) { - for (int k = 0; k < DIM; k++) { - int elems = i * DIM * DIM + j * DIM + k; - for (int m = 0; m < elems; m++) { - foo.b[i][j][k].v.push_back(10); - } - } - } - } - - for (int i = 0; i < *loopcnt; ++i) { - for (int j = 0; j < 3; j++) { - f.push_back("abcdefghijklmn"); - } - for (int j = 0; j < 3; j++) { - f.push_back( - "abcdefghijklmnoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - } - - foo.vectorOfStr = f; - foo.mapOfStr = mv; - foo.vectorOfPair = pv; - - std::vector g = doStuff(foo, mv, f, pv); - - std::cout << "Number of elems = " << g.size() << std::endl; - - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - - f.clear(); - } - - pthread_exit(arg); -} - -int main(int argc, char *argv[]) { - int i = 0; - int err; - pthread_t tid[2]; - char *b; - - // facebook::initFacebook(&argc, &argv); - - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::cout << "main thread = " << syscall(SYS_gettid) << " pid = " << getpid() - << std::endl; - sleep(1); - - std::map mapOfWords; - mapOfWords.insert(std::make_pair("earth", 1)); - mapOfWords.insert(std::make_pair("moon", 2)); - mapOfWords["sun"] = 3; - - std::vector nameList; - nameList.push_back("The quick brown fox"); - nameList.push_back("jumps over "); - nameList.push_back("the "); - nameList.push_back("lazy dog "); - - for (auto it = nameList.begin(); it != nameList.end(); it++) { - std::cout << "nameList: " << *it << " size: " << it->size() << std::endl; - } - - std::cout << "mapOfWords #elements: " << mapOfWords.size() << std::endl; - - int size = 0; - - for (auto it = mapOfWords.begin(); it != mapOfWords.end(); ++it) { - size += it->first.size(); - } - - std::cout << "mapOfWords map addr = " << &mapOfWords << std::endl; - std::cout << "nameList vector addr = " << &nameList << std::endl; - - for (int i = 0; i < 1; ++i) { - err = pthread_create(&(tid[i]), NULL, &doit, (void **)&loopcnt); - - if (err != 0) { - std::cout << "Failed to create thread:[ " << strerror(err) << " ]" - << std::endl; - } - } - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - for (int i = 0; i < 1; ++i) { - pthread_join(tid[i], (void **)&b); - } - - exit(EXIT_SUCCESS); -} diff --git a/test/mttest4.cpp b/test/mttest4.cpp deleted file mode 100644 index e4ac473..0000000 --- a/test/mttest4.cpp +++ /dev/null @@ -1,248 +0,0 @@ -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -// #include "common/init/Init.h" - -static char textPad __attribute__((used)); - -typedef union { - int i; - float f; - char c; -} UN; -typedef UN UN2; -typedef struct { - int i; - float f; - char c; -} ST; -typedef ST ST2; -typedef int INT_TYPE; - -/*class Bar { - std::string bar; -};*/ - -class Foo { - public: - std::vector vectorOfStr; - std::multimap intToStrMultiMap; - /* std::vector> mapOfStr; - bool myb; - std::vector> vectorOfPair; */ - /*UN unionVar; - UN2 unionVar2; - ST structVar; - ST2 structVar2; - char t; */ - char arr[10]; - int aa; - int bb : 1; - int : 0; - int cc : 5; - int dd : 30; - - // Bar bar_arr[5]; - int ref; -}; - -Foo myGlobalFoo; -// std::unique_ptr myGlobalFoo; - -typedef INT_TYPE INT_ARRAY[10]; -enum ENUM { E_A }; - -// pass in the loop counter in the args -std::vector doStuff(ENUM e, ENUM *e_p, INT_TYPE int_type, - INT_TYPE &int_type_r, INT_TYPE *int_type_p, - INT_TYPE **int_type_pp, INT_ARRAY int_array, Foo &foo, - std::vector> &m, - std::vector &f, - std::vector> &p) { - std::vector altvect = {1, 3, 5, 7}; - foo.ref++; - myGlobalFoo.vectorOfStr.push_back(std::string("Test String")); - - std::cout << e << e_p << int_type << int_type_r << (uintptr_t)&int_type_p - << (uintptr_t)&int_type_pp << int_array; - std::cout << " doStuff entries: " << f.size() << std::endl; - std::cout << " addr of f = " << reinterpret_cast(&f) << std::endl; - std::cout << " addr of m = " << reinterpret_cast(&m) << std::endl; - std::cout << " addr of p = " << reinterpret_cast(&p) << std::endl; - std::cout << " addr of myGlobalFoo = " - << reinterpret_cast(&myGlobalFoo) << std::endl; - - std::vector newvect(altvect); - - std::cout << " addr of newvect = " << reinterpret_cast(&newvect) - << std::endl; - - return newvect; -} - -void doStuff(std::vector &f, int i) { - f.push_back(i); - std::cout << "Entries in f: " << f.size() << std::endl; -} - -void *doit(void *arg) { - int *loopcnt = reinterpret_cast(arg); - std::vector f; - f.reserve(200); - std::vector> mv; - - std::unordered_map m; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = "ba"; - m["a"] = "baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"] = - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbaaaaaaaaaaa"] = "bbb"; - m["aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacccccccccccaaaaaaaa"] = "bbbb"; - - mv.push_back(m); - mv.push_back(m); - mv.push_back(m); - - std::vector> pv; - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdef", 10); - pv.push_back(p); - } - { - std::pair p( - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabcdefghi", 10); - pv.push_back(p); - } - - for (int i = 0; i < *loopcnt; ++i) { - for (int j = 0; j < 3; j++) { - f.push_back("abcdefghijklmn"); - } - for (int j = 0; j < 3; j++) { - f.push_back( - "abcdefghijklmnoaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - } - Foo foo; - - std::multimap mm; - - mm.insert(std::pair(0, 0)); - mm.insert(std::pair(1, 10)); - mm.insert(std::pair(2, 20)); - mm.insert(std::pair(3, 30)); - - mm.insert(std::pair(1, 100)); - - foo.intToStrMultiMap = mm; - - /*foo.vectorOfStr = f; - foo.mapOfStr = mv; - foo.vectorOfPair = pv;*/ - /*foo.bar_arr[0].bar = ""; - foo.bar_arr[1].bar = "0123456789"; - foo.bar_arr[2].bar = "01234567890123456789"; - foo.bar_arr[3].bar = "0123456789012345678901234567890123456789"; - foo.bar_arr[4].bar = - "01234567890123456789012345678901234567890123456789012345678901234567890123456789";*/ - - std::vector> dummy; - INT_TYPE int_type; - INT_TYPE *int_type_p; - // INT_TYPE arr[10]; - INT_ARRAY int_arr; - ENUM enum_type; - std::vector g = - doStuff(enum_type, &enum_type, int_type, int_type, int_type_p, - &int_type_p, int_arr, foo, dummy, f, pv); - doStuff(g, i); - - std::cout << "Number of elems = " << g.size() << std::endl; - - std::this_thread::sleep_for(std::chrono::milliseconds(10000)); - - f.clear(); - } - - pthread_exit(arg); -} - -int main(int argc, char *argv[]) { - int i = 0; - int err; - pthread_t tid[2]; - char *b; - - // facebook::initFacebook(&argc, &argv); - - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - std::cout << "main thread = " << syscall(SYS_gettid) << " pid = " << getpid() - << std::endl; - sleep(1); - - std::map mapOfWords; - mapOfWords.insert(std::make_pair("earth", 1)); - mapOfWords.insert(std::make_pair("moon", 2)); - mapOfWords["sun"] = 3; - - std::vector nameList; - nameList.push_back("The quick brown fox"); - nameList.push_back("jumps over "); - nameList.push_back("the "); - nameList.push_back("lazy dog "); - - for (auto it = nameList.begin(); it != nameList.end(); it++) { - std::cout << "nameList: " << *it << " size: " << it->size() << std::endl; - } - - std::cout << "mapOfWords #elements: " << mapOfWords.size() << std::endl; - - int size = 0; - - for (auto it = mapOfWords.begin(); it != mapOfWords.end(); ++it) { - size += it->first.size(); - } - - std::cout << "mapOfWords map addr = " << &mapOfWords << std::endl; - std::cout << "nameList vector addr = " << &nameList << std::endl; - - for (int i = 0; i < 1; ++i) { - err = pthread_create(&(tid[i]), NULL, &doit, (void **)&loopcnt); - - if (err != 0) { - std::cout << "Failed to create thread:[ " << strerror(err) << " ]" - << std::endl; - } - } - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - for (int i = 0; i < 1; ++i) { - pthread_join(tid[i], (void **)&b); - } - - exit(EXIT_SUCCESS); -} diff --git a/test/userDef1.cpp b/test/userDef1.cpp deleted file mode 100644 index c6a3b10..0000000 --- a/test/userDef1.cpp +++ /dev/null @@ -1,44 +0,0 @@ -#include - -#include -#include -#include -#include - -typedef struct userDef { - int var1; - char var2; - void *var3; - char var4[256]; -} userDef; - -int main(int argc, char *argv[]) { - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - userDef udefs[10]; - - int loopcnt = atoi(argv[1]); - - std::vector userDefList; - - for (int i = 0; i < 10; ++i) { - userDefList.push_back(userDef()); - } - - int i = 0; - for (auto udef : userDefList) { - std::cout << "userDefList[" << i << "]= " << sizeof(udef) << std::endl; - } - - std::cout << "pid = " << getpid() - << " Address of userDefList = " << &userDefList << std::endl; - ; - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } -} diff --git a/test/vector.cpp b/test/vector.cpp deleted file mode 100644 index 551a87d..0000000 --- a/test/vector.cpp +++ /dev/null @@ -1,115 +0,0 @@ -#include -#include - -#include -#include -#include -#include -#include -#include - -class Emp { - std::string name; - int age; - std::vector colleagues; - - public: - Emp(std::string name1) { - name = name1; - }; - void setName(std::string name1) { - name = name1; - std::cout << "name: " << name << std::endl; - }; - std::string getName(void) { - return name; - }; - void setAge(int age) { - age = age; - }; - void addColleague(Emp p) { - colleagues.emplace(colleagues.begin(), p); - }; - std::vector getColleagues(void) { - return colleagues; - } -}; - -class Comp { - std::string name; - std::vector companies; - - public: - Comp(std::string name1) { - name = name1; - }; - std::vector getComps(void) { - return companies; - } -}; - -void foo(class Emp& me) { - std::vector colleagues = me.getColleagues(); - int size = colleagues.size(); - std::cout << size << std::endl; - std::cout << colleagues[4].getName().size() << std::endl; -} - -int main(int argc, char* argv[]) { - if (argc != 2) { - std::cout << "Usage: " << argv[0] << " " << std::endl; - exit(1); - } - - int loopcnt = atoi(argv[1]); - - Emp Jon("Jon Haslam"); - Emp Mark(std::string("Mark Santaniello")); - Emp Kalyan(std::string("Kalyan Saladi")); - Emp Banit(std::string("Banit Agrawal")); - Emp Harit(std::string("Harit Modi")); - Emp Amlan(std::string("Amlan Nayak")); - Emp Blaise(std::string("Blaise Sanouillet")); - - Jon.addColleague(Mark); - Jon.addColleague(Kalyan); - Jon.addColleague(Banit); - Jon.addColleague(Harit); - Jon.addColleague(Amlan); - Jon.addColleague(Blaise); - - std::vector TestVec{10, 20, 30, 20, 10, 40}; - - int total = 0; - for (auto it = TestVec.begin(); it != TestVec.end(); it++) { - total += *it; - } - - std::cout << "Total = " - << " " << total << std::endl; - - Comp bus("facebook"); - std::vector m = bus.getComps(); - std::cout << "Number of Comps: " << m.size() << std::endl; - - std::vector mycol = Jon.getColleagues(); - - for (auto it = mycol.begin(); it != mycol.end(); ++it) { - std::cout << "Colleague: " << it->getName().size() - << " size: " << sizeof(*it) << std::endl; - } - - // std::cout << "mycol addr = " << &mycol << std::endl; - std::cout << "TestVec addr = " << &TestVec << std::endl; - // std::cout << "Number of Colleagues: " << mycol.size() << std::endl; - - std::cout << "pid == " << getpid() << " (hit RETURN to continue)" - << std::endl; - - for (int i = 0; i < loopcnt; i++) { - std::cout << "i: " << i << std::endl; - std::this_thread::sleep_for(std::chrono::milliseconds(1000)); - } - - foo(Jon); -}