滴滴测开一二面面筋


1.列举15个常用的linux指令,并解释用法
软链接和硬链接


2.统计一个ip记录文件中的top5 ip


3.数据库两个表的联查


4.实现一个函数:把表示整形的字符串转化为整形
不可以使用int强制转换函数



5.在一个字符串中,找到第一个只出现一次的字符,比如字符串是ccdeeefabb,则该字符是d


二面

已知服务A的请求方法为:
int requestA(Request &req,int timeout, int &timecost){
    // timeout: 超时时间 单位ms
    // timecost: 本次请求耗时
     return errno;// 成功0,失败1
}
设计一个简单压测工具,支持并发请求A一段时间,并统计全部请求成功数、失败数、平均响应时间和XX(1~99)分位耗时阈值。
说明:
1、假设请求设置的超时时间是1000ms,如果发生超时,认为请求失败
2、XX分位耗时阈值:XX%的请求处理时间耗时在多长时间以内,精度到ms。
3、假设总请求总数少于32亿

以下线程池实现可以直接使用,也可以自己的方式实现并发。
class ThreadPool {
    ThreadPool(int threadnum){}
    std::list<std::function<void(void)>> queue;
    /**
     *  Add a new job to the pool. If there are no jobs in the queue,
     *  a thread is woken up to take the job. If all threads are busy,
     *  the job is added to the end of the queue.
     */
    void AddJob( std::function<void(void)> job ) {}
    /**
     *  Join with all threads.
     */
    void JoinAll( bool WaitForAll = true ) {}
};


#滴滴#
全部评论
上海面的?
点赞 回复 分享
发布于 2017-09-27 19:26

相关推荐

只写bug的程序媛:才15,我招行20多万,建设银行50多万,说放弃就放弃
点赞 评论 收藏
分享
02-03 12:20
门头沟学院 Java
一天代码十万三:你这个简历东西太杂了,根本看不出你想投什么岗位
点赞 评论 收藏
分享
评论
2
29
分享

创作者周榜

更多
牛客网
牛客企业服务