服务器压力测试

1.基础信息: 数据库配置和Socket 服务配置,模块选择以及 模拟数量配置

2.关于终端信息更改如何更新到UI上面

把终端信息给观察者集合,把观察者集合赋值给UIItem,XAML 需要绑定对应的字段

每一行代表一个终端信息

另外 终端类必须继承属性变更通知 INotifyPropertyChanged 接口

ObservableCollection,首先它是一个集合,但它是一个既实现了INotifyPropertyChanged接口又实现了INotifyCollectionChanged接口的集合,这是它与List<T>的不同之处

http://www.cnblogs.com/luacloud/archive/2011/12/13/2285981.html

http://www.cnblogs.com/Jax/archive/2009/10/13/1582128.html

3.根据下拉框中不同的选项  调用不同的类

for 循环 调用Parking,把没一行数据转换为参数传入进去,开启Start方法

4.Start 方法,一个通用的任务类,只有当所有设备全部 启动的时候 才进行TagA 里面的方法

System.Threading.Tasks.Task task = new System.Threading.Tasks.Task(new Action(() =>
            {           
                MainWindow.Myindow.UpTaskCount();
                bool bStartAll = false;
                while (!bStartAll)
                {
                    //当全部任务类准备好的时候一次性并发开始  如果有掉线的  会重新启动 这种方法会导致长时间 没有心跳
                    bStartAll = MainWindow.Myindow.StartTaskCount >= MainWindow.Myindow.PlanStartTaskCount;
                    if (bStartAll)
                    {
//TagA
//初始化SocketClient
   terminalInfo.XinTiaoNoResponseCount = 0;
                        isSetTimeOver = false;
                        socketClient = new SocketClient(ipAddress, port);
                        socketClient.SocketReceice += new SocketProcHandler(socketClient_SocketReceice);
                        socketClient.SocketColse += new EventHandler(socketClient_SocketColse);
                        bool bConnect = false;
                        while (!bConnect)
                        {
                            if (cts.IsCancellationRequested)
                            {
                                break;
                            }
                            if (closeCts.IsCancellationRequested)
                            {
                                break;
                            }

                            bConnect = socketClient.Connect();
                            if (bConnect)
                            {
                                //开始终端机任务
                                DoTerminalTask();
                            }
                            else
                            {
                                ShowSendData("连接失败。");
                                BaseFun.WaitTime(1 * 1000);
                            }
                        }
} }
else { BaseFun.WaitTime(500); } } }), TaskCreationOptions.LongRunning); task.Start();

posted @ 2016-02-25 15:18  maanshancss  阅读(794)  评论(0编辑  收藏  举报