To estimate the database's effective!

来源:互联网 发布:算法的国内现状 编辑:程序博客网 时间:2024/05/16 11:51

 Use the System.currentTimeMillis() to estimate the database's effetive!

Code:

        Timestamp st=new Timestamp(System.currentTimeMillis());
        customer = (CustomerInfo) sqlMapSE.queryForObject("queryCustomerByname", userName);
        Timestamp et=new Timestamp(System.currentTimeMillis());
        try
        {
            out.write("1: queryCustomerByname            "+(et.getTime()-st.getTime())+" ");
            out.write("/r/n");
            out.flush();
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }

or more simple:

        long st=System.currentTimeMillis();
        List list = sqlMapSE.queryForList("queryMarketBySector", hm);
        long et=System.currentTimeMillis();
        try
        {
           out.write("3: queryMarketBySector    "+(et-st));
           out.write("/r/n");
           out.flush();
        }
        catch(Exception e)
        {
           e.printStackTrace();
        }

 

原创粉丝点击