简体   繁体   English

限制拉链速度

[英]Limit zipping speed

I want to write c++ program that will put selected files from my lan into zip. 我想编写c ++程序,它将局域网中的选定文件放入zip文件中。 But my problem is that i dont know how to limit speed of that process. 但是我的问题是我不知道如何限制该过程的速度。 Do you have any idea how to do that? 你有什么想法吗?

Sorry for my bad english :P . 对不起,我的英语不好:P。

Edit 编辑

Lets imagine lan with ~16 PCs and u want to "backup" 5 GB from each to server. 假设有大约16台PC的局域网,而您想将每台PC的5 GB备份到服务器。 And while this "backup" takes time u want to check something in web. 而且,尽管“备份”需要花费时间,但您还是想检查Web中的某些内容。 Impossible because netwotk packed up. 不可能,因为netwotk收拾了东西。

What I want to accomplish is lowering load on lan by specifying speed in bytes. 我要完成的工作是通过指定以字节为单位的速度来降低局域网的负载。 It doesnt even matter if it wont be exact, but precise has to be about 10-15%. 即使精确,也没有关系,但是精确度必须为10-15%。

"You don't want to limit zipping speed, but lower bandwidth usage. – bartimar" Ure right. “您不想限制压缩速度,但要降低带宽使用量。– bartimar”非常正确。

The system will always try to execute orders as fast as possible. 系统将始终尝试尽快执行订单。 If you want to really slow down a process, you can make it 如果您想真正减慢流程,可以进行

sleep()

It does not really make sense though to slow down your application. 尽管减慢您的应用程序的速度并没有什么意义。 Are you maybe waiting for your data IO instead? 您是否正在等待数据IO? In that case, use some sort of callback to compress data whenever enough is available. 在这种情况下,只要有足够的空间,就使用某种回调来压缩数据。

如果您担心会对整个系统的性能产生负面影响,请将线程或进程的优先级设置为低于正常甚至空闲的优先级。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM