disk

Get hardware information from /proc filesytem in Linux

早过忘川 提交于 2019-12-01 10:26:28
I use execv to run lshw command to get the CPU, disk, and memory in C code. But I would like to search another solution to get these information from /proc or any other existed data. Have any suggestion? Here is my code: char *params[9] = {"/usr/bin/lshw", "-short", "-c", "disk", "-c", "memory", "-c", "processor", 0}; //cmd params filled execv(params[0], params); Linux command: $ sudo lshw -short -c disk -c processor -c memory $ sudo lshw -short -c disk -c processor -c memory H/W path Device Class Description ====================================================== /0/0 memory 64KiB BIOS /0/22

Profiling disk access

别来无恙 提交于 2019-12-01 03:57:17
问题 Currently I am working on a MFC application which reads and writes in to the disk. Sometimes this application runs amazingly fast and sometimes it is damn slow. I am guessing that it is because of the disk access involved, hence I want to profile it. These are some questions in this regard: (1).Currently I am using AQTime profiler to profile the application. Has anybody tried profiling disk access using this? or is there any other tool available which I can use? (2). What are the most

How to reduce disk space usage in a large repository?

一曲冷凌霜 提交于 2019-12-01 00:41:05
I have a git repository with about 1 year of development history, and it is already 37GB. How can I minimize the size in a way where I will delete the old history? That is, I only need the history that covers the last 2 months, others can be removed. VonC The three main options are: removing large files from the history ( with, for instance, BFG ) split a repo subfolder into its own repo split a repo history (starting with a new repo from HEAD of new repo, keeping the old one for archive). On the last point, see " How do I remove the old history from a git repository? ", using a script like

Identifying CDs

試著忘記壹切 提交于 2019-11-30 22:20:10
I'd like to be able to determine what music album CD is in a CD drive. For example, if someone claims that the CD in their drive is Eminem - The Eminem Show, I would like to be able to verify that the CD is indeed The Eminem Show. Any ideas? I've applied for a Gracenote developer license, but they won't get back to me for five days. Also, how does this work? Is there some GUID or other unique identifier that music discs are encoded with? Lastly, might this be possible with data CDs, like, say, the Diablo II install Disc 1? If so, any directions you can point me in, for accomplishing this? You

How to reduce disk space usage in a large repository?

扶醉桌前 提交于 2019-11-30 20:43:21
问题 I have a git repository with about 1 year of development history, and it is already 37GB. How can I minimize the size in a way where I will delete the old history? That is, I only need the history that covers the last 2 months, others can be removed. 回答1: The three main options are: removing large files from the history (with, for instance, BFG) split a repo subfolder into its own repo split a repo history (starting with a new repo from HEAD of new repo, keeping the old one for archive). On

How to handle large numbers of concurrent disk write requests as efficiently as possible

本秂侑毒 提交于 2019-11-30 19:24:50
Say the method below is being called several thousand times by different threads in a .net 4 application. What’s the best way to handle this situation? Understand that the disk is the bottleneck here but I’d like the WriteFile() method to return quickly. Data can be can be up to a few MB. Are we talking threadpool, TPL or the like? public void WriteFile(string FileName, MemoryStream Data) { try { using (FileStream DiskFile = File.OpenWrite(FileName)) { Data.WriteTo(DiskFile); DiskFile.Flush(); DiskFile.Close(); } } catch (Exception e) { Console.WriteLine(e.Message); } } Since you say that the

Cross platform way to list disk drives on Linux, Windows and Mac using Python?

耗尽温柔 提交于 2019-11-30 18:40:17
I am using Python2.6. I am trying to list the disk drives that a system may have. On Windows, it may be something like C:/ , D:/ , E:/ , etc. On Linux, it may be something like /boot , /media/SDCard , etc. And I don't know what it's like on a Mac. Maybe something under /Volumes. Does anyone know of a cross platform way (that is, one which works on Linux, Windows and Mac) in Python? Thanks! There isn't really a unified naming scheme for Linux devices that guarantees you a formatable block device. There are conventions, but they can vary widely and I can call my thumb-drive /Thomas/O if I want

boost::circular_buffer equivalent for files?

馋奶兔 提交于 2019-11-30 16:32:18
I am looking for a library which allows to get a circular buffer on disk. In Boost there is something similar, but it is an in memory based container: circular_buffer . You can call it whatever you think is natural. You're looking for memory mapped files. Using the right allocator, you can make containers be allocating in this memory mapped region. That would make the container "on disk". I'll see whether Boost Circularbuffer supports this directly. Update Yes. The best thing is, this gives you full possibility to even use IPC synchronization and thread synchronization. Using a "private"

【原创】CPU 100%+磁盘写满 问题排查

会有一股神秘感。 提交于 2019-11-30 11:36:21
情景:测试人员在进行 RabbitMQ 服务器问题排查时,进行了各种重启操作,之后突然发现机器变的很卡。 排查过程: 1. 通过 top 查看,发现名为 sa 的进程 CPU 占用率几乎 100% 。 2. 查看 sa 进程中哪个线程占用 CPU 比较高 [root@rmq_2 ~]# top -Hp 1362 top - 05:36:26 up 2 days, 3:08, 2 users, load average: 1.77, 3.69, 5.11 Tasks: 16 total, 0 running, 16 sleeping, 0 stopped, 0 zombie Cpu0 : 0.4%us, 2.8%sy, 0.0%ni, 95.7%id, 0.0%wa, 1.1%hi, 0.0%si, 0.0%st Cpu1 : 0.4%us, 14.7%sy, 0.0%ni, 29.4%id, 53.8%wa, 0.0%hi, 1.8%si, 0.0%st Cpu2 : 0.7%us, 2.1%sy, 0.0%ni, 95.9%id, 0.0%wa, 0.0%hi, 1.4%si, 0.0%st Cpu3 : 0.3%us, 5.8%sy, 0.0%ni, 77.1%id, 16.4%wa, 0.0%hi, 0.3%si, 0.0%st Mem: 3924376k total,

How does one programmatically mount a drive in Windows?

假装没事ソ 提交于 2019-11-30 07:36:17
We make and sell a device that our users will sometimes want to connect to their computer in large quantities with multiple USB hubs. It is a USB composite device that has both human interface (HID) and mass storage (MSD) interfaces. Windows automatically mounts the file-system of each device until it runs out of letters at 'Z:'. I can walk the device tree and get the device instance identifiers for the HID and USBSTOR interfaces using a combination of the PnP Configuration Manager and Device Installation functions. With the USB storage device path I can also get the disk number (i.e. \\.