Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            const int NUM_THREADS = 8; //reccomended 36 symbols per thread
            ArrayList arList      = new ArrayList();
            ArrayList qrResults;
            Stopwatch sw = new Stopwatch();

            // (284 * 2) symbols is suggested for stress test.
            arList.Add("goog"); arList.Add("A"); arList.Add("AA"); arList.Add("AA-B"); arList.Add("HBI"); arList.Add("HCN"); arList.Add("HE"); arList.Add("HF");
            //ThreadStockerWrapper(threads,function_name,stocknames_arraylist);
            ThreadStockWrapper Stocker = new ThreadStockWrapper(NUM_THREADS, "getLatestValue", arList); //see available functions above to call.

            sw.Start();
            qrResults = Stocker.threadStockCall(); // returns back a QuerryResults ArrayList();
            sw.Stop();
            foreach (QueryResults qr in qrResults)
            {
                if (qr.isString)
                {
                    Console.WriteLine(qr.sSymbol + " " + qr.sResult + " " + qr.sQuery);
                }
                else
                { //results have a double instead.
                    Console.WriteLine(qr.sSymbol + " " + qr.dResult + " " + qr.sQuery);
                }
            }
            Console.WriteLine("Elapsed Miliseconds " + sw.ElapsedMilliseconds);
        }
Ejemplo n.º 2
0
 static void Main(string[] args)
 {
     const int NUM_THREADS = 8; //reccomended 36 symbols per thread
     ArrayList arList = new ArrayList();
     ArrayList qrResults;
     Stopwatch sw = new Stopwatch();
     // (284 * 2) symbols is suggested for stress test.
     arList.Add("goog"); arList.Add("A"); arList.Add("AA"); arList.Add("AA-B"); arList.Add("HBI"); arList.Add("HCN"); arList.Add("HE"); arList.Add("HF");
     //ThreadStockerWrapper(threads,function_name,stocknames_arraylist);
     ThreadStockWrapper Stocker = new ThreadStockWrapper(NUM_THREADS, "getLatestValue", arList); //see available functions above to call.
     sw.Start();
     qrResults = Stocker.threadStockCall(); // returns back a QuerryResults ArrayList();
     sw.Stop();
     foreach (QueryResults qr in qrResults)
     {
         if (qr.isString)
         {
             Console.WriteLine(qr.sSymbol + " " + qr.sResult + " " + qr.sQuery);
         }
         else
         { //results have a double instead.
             Console.WriteLine(qr.sSymbol + " " + qr.dResult + " " + qr.sQuery);
         }
     }
     Console.WriteLine("Elapsed Miliseconds " + sw.ElapsedMilliseconds);
 }